diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp index 17180cc304..0fcd0bc00e 100644 --- a/generator/feature_builder.cpp +++ b/generator/feature_builder.cpp @@ -581,10 +581,10 @@ bool FeatureBuilder1::IsDrawableInRange(int lowScale, int highScale) const FeatureBase const fb = GetFeatureBase(); while (lowScale <= highScale) + { if (feature::IsDrawableForIndex(fb, lowScale++)) return true; - - return RequireGeometryInIndex(fb); + } } return false; diff --git a/generator/feature_helpers.cpp b/generator/feature_helpers.cpp index 69166ff14b..ee14e4fa9f 100644 --- a/generator/feature_helpers.cpp +++ b/generator/feature_helpers.cpp @@ -29,7 +29,7 @@ void CalculateMidPoints::operator()(FeatureBuilder1 const & ft, uint64_t pos) /// May be invisible if it's small area object with [0-9] scales. /// @todo Probably, we need to keep that objects if 9 scale (as we do in 17 scale). - if (minScale != -1 || feature::RequireGeometryInIndex(ft.GetFeatureBase())) + if (minScale != -1) { uint64_t const order = (static_cast(minScale) << 59) | (pointAsInt64 >> 5); m_vec.push_back(make_pair(order, pos)); diff --git a/generator/search_index_builder.cpp b/generator/search_index_builder.cpp index e54b5fdfc7..48441fd5f5 100644 --- a/generator/search_index_builder.cpp +++ b/generator/search_index_builder.cpp @@ -101,9 +101,6 @@ public: void GetCategoryTypes(CategoriesHolder const & categories, pair const & scaleRange, feature::TypesHolder const & types, vector & result) { - Classificator const & c = classif(); - auto const & invisibleChecker = ftypes::IsInvisibleIndexedChecker::Instance(); - for (uint32_t t : types) { // Truncate |t| up to 2 levels and choose the best category match to find explicit category if @@ -122,23 +119,13 @@ void GetCategoryTypes(CategoriesHolder const & categories, pair const if (!categories.IsTypeExist(t)) continue; - // There are some special non-drawable types we plan to search on. - if (invisibleChecker.IsMatched(t)) - { - result.push_back(t); - continue; - } + // Drawable scale must be normalized to indexer scales. + auto indexedRange = scaleRange; + if (scaleRange.second == scales::GetUpperScale()) + indexedRange.second = scales::GetUpperStyleScale(); // Index only those types that are visible. - 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) + if (feature::IsVisibleInRange(t, indexedRange)) result.push_back(t); } } diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp index d4f1b6f30f..7161d8cf45 100644 --- a/indexer/feature_visibility.cpp +++ b/indexer/feature_visibility.cpp @@ -219,7 +219,6 @@ namespace /// Add here all exception classificator types: needed for algorithms, /// but don't have drawing rules. - /// See also ftypes_matcher.cpp, IsInvisibleIndexedChecker. bool TypeAlwaysExists(uint32_t type, EGeomType g = GEOM_UNDEFINED) { if (!classif().IsTypeValid(type)) @@ -264,18 +263,6 @@ namespace } } -bool RequireGeometryInIndex(FeatureBase const & f) -{ - TypesHolder const types(f); - - for (uint32_t t : types) - { - if (HasRoutingExceptionType(t)) - return true; - } - return false; -} - bool IsDrawableAny(uint32_t type) { return (TypeAlwaysExists(type) || classif().GetObject(type)->IsDrawableAny()); @@ -321,8 +308,10 @@ bool IsDrawableForIndexClassifOnly(FeatureBase const & f, int level) IsDrawableChecker doCheck(level); for (uint32_t t : types) - if (c.ProcessObjects(t, doCheck)) + { + if (TypeAlwaysExists(t) || c.ProcessObjects(t, doCheck)) return true; + } return false; } @@ -433,6 +422,22 @@ pair GetDrawableScaleRange(TypesHolder const & types) return (res.first > res.second ? make_pair(-1, -1) : res); } +bool IsVisibleInRange(uint32_t type, pair const & scaleRange) +{ + CHECK_LESS_OR_EQUAL(scaleRange.first, scaleRange.second, (scaleRange)); + if (TypeAlwaysExists(type)) + return true; + + Classificator const & c = classif(); + for (int scale = scaleRange.first; scale <= scaleRange.second; ++scale) + { + IsDrawableChecker doCheck(scale); + if (c.ProcessObjects(type, doCheck)) + return true; + } + return false; +} + namespace { bool IsDrawableForRules(TypesHolder const & types, int level, int rules) diff --git a/indexer/feature_visibility.hpp b/indexer/feature_visibility.hpp index 42a65aa827..09011303a2 100644 --- a/indexer/feature_visibility.hpp +++ b/indexer/feature_visibility.hpp @@ -28,10 +28,6 @@ namespace feature bool IsDrawableForIndexClassifOnly(FeatureBase const & f, int level); bool IsDrawableForIndexGeometryOnly(FeatureBase const & f, int level); - // Exception features which have no styles, but must be present in index for some reasons. - // For example routing edges with render=no tag (Le mans tunnel). - bool RequireGeometryInIndex(FeatureBase const & f); - /// For FEATURE_TYPE_AREA need to have at least one area-filling type. bool IsDrawableLike(vector const & types, EGeomType geomType); /// For FEATURE_TYPE_AREA removes line-drawing only types. @@ -46,6 +42,7 @@ namespace feature /// @name Get scale range when feature is visible. pair GetDrawableScaleRange(uint32_t type); pair GetDrawableScaleRange(TypesHolder const & types); + bool IsVisibleInRange(uint32_t type, pair const & scaleRange); /// @name Get scale range when feature's text or symbol is visible. enum diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp index 1cbe5b0a2d..09c739be36 100644 --- a/indexer/ftypes_matcher.cpp +++ b/indexer/ftypes_matcher.cpp @@ -378,14 +378,6 @@ IsFoodChecker:: IsFoodChecker() m_types.push_back(c.GetTypeByPath({path[0], path[1]})); } -IsInvisibleIndexedChecker::IsInvisibleIndexedChecker() : BaseChecker(1 /* level */) -{ - m_types.push_back(classif().GetTypeByPath({"internet_access"})); - m_types.push_back(classif().GetTypeByPath({"wheelchair"})); - m_types.push_back(classif().GetTypeByPath({"sponsored"})); - m_types.push_back(classif().GetTypeByPath({"event"})); -} - IsCityChecker::IsCityChecker() { m_types.push_back(classif().GetTypeByPath({"place", "city"})); diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp index a3643fc410..620f7e5ee8 100644 --- a/indexer/ftypes_matcher.hpp +++ b/indexer/ftypes_matcher.hpp @@ -205,14 +205,6 @@ public: DECLARE_CHECKER_INSTANCE(IsFoodChecker); }; -// Checks for types that are not drawable, but searchable. -class IsInvisibleIndexedChecker : public BaseChecker -{ - IsInvisibleIndexedChecker(); -public: - DECLARE_CHECKER_INSTANCE(IsInvisibleIndexedChecker); -}; - class IsCityChecker : public BaseChecker { IsCityChecker(); diff --git a/search/search_integration_tests/smoke_test.cpp b/search/search_integration_tests/smoke_test.cpp index ae798e1906..76585578be 100644 --- a/search/search_integration_tests/smoke_test.cpp +++ b/search/search_integration_tests/smoke_test.cpp @@ -186,21 +186,22 @@ UNIT_CLASS_TEST(SmokeTest, CategoriesTest) for (auto const & tags : invisibleTags) invisibleTypes.insert(classif().GetTypeByPath(tags)); - // todo(@t.yan): fix some or delete category. - vector> const badTags = {{"building", "address"}, {"entrance"}, - {"internet_access"}, {"internet_access", "wlan"}, - {"place", "continent"}, {"place", "region"}, - {"event", "fc2018_city"}, {"sponsored", "holiday"}}; - set badTypes; - for (auto const & tags : badTags) - badTypes.insert(classif().GetTypeByPath(tags)); + vector> const notSupportedTags = {// Not visible because excluded by TypesSkipper. + {"building", "address"}, + {"entrance"}, + // Not visible for country scale range. + {"place", "continent"}, + {"place", "region"}}; + set notSupportedTypes; + for (auto const & tags : notSupportedTags) + notSupportedTypes.insert(classif().GetTypeByPath(tags)); auto const & holder = GetDefaultCategories(); auto testCategory = [&](uint32_t type, CategoriesHolder::Category const &) { if (invisibleTypes.find(type) != invisibleTypes.end()) return; - if (badTypes.find(type) != badTypes.end()) + if (notSupportedTypes.find(type) != notSupportedTypes.end()) return; string const countryName = "Wonderland";