From b7b98f376f8c11cf9ccc486b0b199d4258e6ee1b Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Thu, 26 Jan 2017 19:01:25 +0300 Subject: [PATCH 1/2] [generator] Make internet_access type always present --- indexer/feature_visibility.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp index 20adbd8853..ac2df169ab 100644 --- a/indexer/feature_visibility.cpp +++ b/indexer/feature_visibility.cpp @@ -215,6 +215,7 @@ namespace static const uint32_t psurface = classif().GetTypeByPath({ "psurface" }); static const uint32_t wheelchair = classif().GetTypeByPath({ "wheelchair" }); static const uint32_t sponsored = classif().GetTypeByPath({ "sponsored" }); + static const uint32_t internet = classif().GetTypeByPath({ "internet_access" }); // Caching type length to exclude generic [wheelchair]. uint8_t const typeLength = ftype::GetLevel(type); @@ -237,7 +238,7 @@ namespace if (wheelchair == type && typeLength == 2) return true; - if (sponsored == type) + if (sponsored == type || internet == type) return true; return false; From 135290d877bb4f6418ab6c9d89750af0be20c62f Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Fri, 27 Jan 2017 18:35:24 +0300 Subject: [PATCH 2/2] [search] Special treatment for internet_access and wheelchair types --- generator/search_index_builder.cpp | 8 ++++++++ indexer/feature_visibility.cpp | 1 + indexer/ftypes_matcher.cpp | 12 ++++++++++++ indexer/ftypes_matcher.hpp | 9 +++++++++ 4 files changed, 30 insertions(+) diff --git a/generator/search_index_builder.cpp b/generator/search_index_builder.cpp index 78e08059a2..377c306aaf 100644 --- a/generator/search_index_builder.cpp +++ b/generator/search_index_builder.cpp @@ -100,6 +100,7 @@ void GetCategoryTypes(CategoriesHolder const & categories, pair const feature::TypesHolder const & types, vector & result) { Classificator const & c = classif(); + auto const & invisibleChecker = ftypes::IsInvisibleIndexedChecker::Instance(); for (uint32_t t : types) { @@ -112,6 +113,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(t)) + { + result.push_back(t); + continue; + } + // Index only those types that are visible. pair r = feature::GetDrawableScaleRange(t); CHECK_LESS_OR_EQUAL(r.first, r.second, (c.GetReadableObjectName(t))); diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp index ac2df169ab..1b0e5ea084 100644 --- a/indexer/feature_visibility.cpp +++ b/indexer/feature_visibility.cpp @@ -208,6 +208,7 @@ 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) { static const uint32_t roundabout = classif().GetTypeByPath({ "junction", "roundabout" }); diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp index ec939f1880..ee5c1584e2 100644 --- a/indexer/ftypes_matcher.cpp +++ b/indexer/ftypes_matcher.cpp @@ -431,6 +431,18 @@ IsOpentableChecker const & IsOpentableChecker::Instance() return inst; } +IsInvisibleIndexedChecker::IsInvisibleIndexedChecker() : BaseChecker(1 /* level */) +{ + m_types.push_back(classif().GetTypeByPath({"internet_access"})); + m_types.push_back(classif().GetTypeByPath({"wheelchair"})); +} + +IsInvisibleIndexedChecker const & IsInvisibleIndexedChecker::Instance() +{ + static IsInvisibleIndexedChecker const instance; + return instance; +} + IsLocalityChecker::IsLocalityChecker() { Classificator const & c = classif(); diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp index c3d6e02d5d..760d391120 100644 --- a/indexer/ftypes_matcher.hpp +++ b/indexer/ftypes_matcher.hpp @@ -192,6 +192,15 @@ public: static IsOpentableChecker const & Instance(); }; +// Checks for types that are not drawable, but searchable. +class IsInvisibleIndexedChecker : public BaseChecker +{ + IsInvisibleIndexedChecker(); + +public: + static IsInvisibleIndexedChecker const & Instance(); +}; + /// Type of locality (do not change values and order - they have detalization order) /// COUNTRY < STATE < CITY < ... enum Type { NONE = -1, COUNTRY = 0, STATE, CITY, TOWN, VILLAGE, LOCALITY_COUNT };