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:
authormpimenov <mpimenov@users.noreply.github.com>2017-01-30 12:41:04 +0300
committerGitHub <noreply@github.com>2017-01-30 12:41:04 +0300
commit0e099e063d3db259c9a353cca4e9617b9467eb88 (patch)
tree7e54079db003bbd403533a8da74da223dbc6d2cc
parentc8d16d8c6376b63e7f398fc060bbbdd22c8a8ce3 (diff)
parent135290d877bb4f6418ab6c9d89750af0be20c62f (diff)
Merge pull request #5295 from Zverik/wlan_visbeta-595
[search] Fix wifi test and internet_access=wlan visibility
-rw-r--r--generator/search_index_builder.cpp8
-rw-r--r--indexer/feature_visibility.cpp4
-rw-r--r--indexer/ftypes_matcher.cpp12
-rw-r--r--indexer/ftypes_matcher.hpp9
4 files changed, 32 insertions, 1 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 20adbd8853..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" });
@@ -215,6 +216,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 +239,7 @@ namespace
if (wheelchair == type && typeLength == 2)
return true;
- if (sponsored == type)
+ if (sponsored == type || internet == type)
return true;
return false;
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 };