diff --git a/data/categories.txt b/data/categories.txt index 26e08bc363..ecb1bc33e7 100644 --- a/data/categories.txt +++ b/data/categories.txt @@ -8315,7 +8315,7 @@ zh-Hant:^心臟電擊器 emergency-fire_hydrant en:^Fire Hydrant -ru:^Гидрант +ru:^Гидрант|Пожарный гидрант ar:^صنبور الإطفاء cs:^Požární hydrant da:^Brandhane diff --git a/search/model.cpp b/search/model.cpp index f3fcd82db1..519ca10db7 100644 --- a/search/model.cpp +++ b/search/model.cpp @@ -17,7 +17,9 @@ TwoLevelPOIChecker::TwoLevelPOIChecker() : ftypes::BaseChecker(2 /* level */) {"waterway", "waterfall"}, {"natural", "volcano"}, {"natural", "cave_entrance"}, - {"natural", "beach"}}; + {"natural", "beach"}, + {"emergency", "defibrillator"}, + {"emergency", "fire_hydrant"}}; for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) m_types.push_back(c.GetTypeByPath(arr[i])); diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index c784b837fe..3697254c5f 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -866,5 +866,53 @@ UNIT_CLASS_TEST(ProcessorTest, Numerals) TEST(ResultsMatch("школа", "ru", rules), ()); } } + +UNIT_CLASS_TEST(ProcessorTest, TestWeirdTypes) +{ + string const countryName = "Area51"; + + TestCity tokyo(m2::PointD(0, 0), "東京", "ja", 100 /* rank */); + + TestStreet street(vector{m2::PointD(-8.0, 0.0), m2::PointD(8.0, 0.0)}, "竹下通り", + "ja"); + + TestPOI defibrillator1(m2::PointD(0.0, 0.0), "" /* name */, "en"); + defibrillator1.SetTypes({{"emergency", "defibrillator"}}); + TestPOI defibrillator2(m2::PointD(-5.0, 0.0), "" /* name */, "ja"); + defibrillator2.SetTypes({{"emergency", "defibrillator"}}); + TestPOI fireHydrant(m2::PointD(2.0, 0.0), "" /* name */, "en"); + fireHydrant.SetTypes({{"emergency", "fire_hydrant"}}); + + BuildWorld([&](TestMwmBuilder & builder) { builder.Add(tokyo); }); + + auto countryId = BuildCountry(countryName, [&](TestMwmBuilder & builder) { + builder.Add(street); + builder.Add(defibrillator1); + builder.Add(defibrillator2); + builder.Add(fireHydrant); + }); + + { + TRules rules{ExactMatch(countryId, defibrillator1), ExactMatch(countryId, defibrillator2)}; + TEST(ResultsMatch("defibrillator", "en", rules), ()); + TEST(ResultsMatch("除細動器", "ja", rules), ()); + + TRules onlyFirst{ExactMatch(countryId, defibrillator1)}; + // City + category. Only the first defibrillator is inside. + TEST(ResultsMatch("東京 除細動器", "ja", onlyFirst), ()); + + // City + street + category. + TEST(ResultsMatch("東京 竹下通り 除細動器", "ja", onlyFirst), ()); + } + + { + TRules rules{ExactMatch(countryId, fireHydrant)}; + TEST(ResultsMatch("fire hydrant", "en", rules), ()); + TEST(ResultsMatch("гидрант", "ru", rules), ()); + TEST(ResultsMatch("пожарный гидрант", "ru", rules), ()); + + TEST(ResultsMatch("fire station", "en", TRules{}), ()); + } +} } // namespace } // namespace search