diff --git a/generator/search_index_builder.cpp b/generator/search_index_builder.cpp index c8324f3cd5..9d9c0fa6b4 100644 --- a/generator/search_index_builder.cpp +++ b/generator/search_index_builder.cpp @@ -113,8 +113,13 @@ void GetCategoryTypes(CategoriesHolder const & categories, pair const continue; // Index only those types that are visible. - pair const r = feature::GetDrawableScaleRange(t); - CHECK(r.first <= r.second && r.first != -1, (c.GetReadableObjectName(t))); + pair r = feature::GetDrawableScaleRange(t); + CHECK_LESS_OR_EQUAL(r.first, r.second, (c.GetReadableObjectName(t))); + + // Drawable scale must be normalized to indexer scales. + r.second = min(r.second, scales::GetUpperScale()); + r.first = min(r.first, r.second); + CHECK(r.first != -1, (c.GetReadableObjectName(t))); if (r.second >= scaleRange.first && r.first <= scaleRange.second) result.push_back(t); diff --git a/search/search_integration_tests/search_query_v2_test.cpp b/search/search_integration_tests/search_query_v2_test.cpp index eacd9af05e..1f0e29f612 100644 --- a/search/search_integration_tests/search_query_v2_test.cpp +++ b/search/search_integration_tests/search_query_v2_test.cpp @@ -290,6 +290,8 @@ UNIT_CLASS_TEST(SearchQueryV2Test, TestRankingInfo) "Golden Gate Bridge", "en"); TestPOI goldenGateBridge(m2::PointD(0, 0), "Golden Gate Bridge", "en"); + TestPOI goldenGateAtm(m2::PointD(1, 1), "", "en"); + goldenGateAtm.SetTypes({{"amenity", "atm"}}); TestPOI waterfall(m2::PointD(0.5, 0.5), "", "en"); waterfall.SetTypes({{"waterway", "waterfall"}}); @@ -313,6 +315,7 @@ UNIT_CLASS_TEST(SearchQueryV2Test, TestRankingInfo) { builder.Add(cafe1); builder.Add(cafe2); + builder.Add(goldenGateAtm); builder.Add(goldenGateBridge); builder.Add(goldenGateStreet); builder.Add(lermontov); @@ -362,6 +365,12 @@ UNIT_CLASS_TEST(SearchQueryV2Test, TestRankingInfo) TRules rules{ExactMatch(wonderlandId, waterfall)}; TEST(ResultsMatch("waterfall", rules), ()); } + + SetViewport(m2::RectD(m2::PointD(0.999, 0.999), m2::PointD(1.001, 1.001))); + { + TRules rules = {ExactMatch(wonderlandId, goldenGateAtm)}; + TEST(ResultsMatch("atm", rules), ()); + } } UNIT_CLASS_TEST(SearchQueryV2Test, TestPostcodes)