Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Zverev <zverik@textual.ru>2017-01-27 18:35:24 +0300
committerIlya Zverev <zverik@textual.ru>2017-01-27 19:15:51 +0300
commit135290d877bb4f6418ab6c9d89750af0be20c62f (patch)
tree8538064b41785a72920099f3e8ca352baa102c4e
parentb7b98f376f8c11cf9ccc486b0b199d4258e6ee1b (diff)
[search] Special treatment for internet_access and wheelchair types
-rw-r--r--generator/search_index_builder.cpp8
-rw-r--r--indexer/feature_visibility.cpp1
-rw-r--r--indexer/ftypes_matcher.cpp12
-rw-r--r--indexer/ftypes_matcher.hpp9
4 files changed, 30 insertions, 0 deletions
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<int, int> const
feature::TypesHolder const & types, vector<uint32_t> & 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<int, int> 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<int, int> 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 };