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:
authorYuri Gorshenin <y@maps.me>2016-01-07 12:09:36 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:03:27 +0300
commitde3caa14e222b24eff52e7406e9550181c58d4e1 (patch)
tree8dd4ea3b0a8a8ee123ec08adc8c0175bf00d4153 /indexer/ftypes_matcher.cpp
parent0fb04ab3e369a91742788c1e167376250370edae (diff)
[search] Implementation of a fast calculation of STREET type via search index.
Diffstat (limited to 'indexer/ftypes_matcher.cpp')
-rw-r--r--indexer/ftypes_matcher.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index e8fee50e22..c927b64f54 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -107,24 +107,33 @@ IsRailwayStationChecker const & IsRailwayStationChecker::Instance()
return inst;
}
+// TODO (@y, @m, @vng): this list must be up-to-date with
+// data/categories.txt, so, it worth to generate or parse it from that
+// file.
+// static
+vector<vector<string>> const IsStreetChecker::kPaths = {{"highway", "living_street"},
+ {"highway", "motorway"},
+ {"highway", "motorway_link"},
+ {"highway", "pedestrian"},
+ {"highway", "primary"},
+ {"highway", "primary_link"},
+ {"highway", "residential"},
+ {"highway", "road"},
+ {"highway", "secondary"},
+ {"highway", "secondary_link"},
+ {"highway", "service"},
+ {"highway", "tertiary"},
+ {"highway", "tertiary_link"},
+ {"highway", "track"},
+ {"highway", "trunk"},
+ {"highway", "trunk_link"},
+ {"highway", "unclassified"}};
+
IsStreetChecker::IsStreetChecker()
{
Classificator const & c = classif();
- char const * arr[][2] = {
- { "highway", "trunk" },
- { "highway", "primary" },
- { "highway", "secondary" },
- { "highway", "residential" },
- { "highway", "pedestrian" },
- { "highway", "tertiary" },
- { "highway", "construction" },
- { "highway", "living_street" },
- { "highway", "service" },
- { "highway", "unclassified" }
- };
-
- for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
- m_types.push_back(c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2)));
+ for (auto const & path : kPaths)
+ m_types.push_back(c.GetTypeByPath(path));
}
IsStreetChecker const & IsStreetChecker::Instance()