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
path: root/search
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2019-03-05 19:23:42 +0300
committerAleksandr Zatsepin <alexzatsepin@users.noreply.github.com>2019-03-13 12:57:30 +0300
commit0f3c5e89a59d9df806ad93d026671c9e4d6c0897 (patch)
treea4fb7b12339dade2f3462402c971ccc18b29de63 /search
parent2dd438552d0e1e75524c38d0219704954d8bc129 (diff)
[search] Made the categories cache more permissive.
For example, LocalitiesCache is a CategoriesCache that uses IsLocalityChecker. This checker truncates types to the 2nd level, thus accepting "place-city-capital" as "place-city". On the other hand, before this commit only "place-city" was being added to the categories cache and now we add the whole subtree.
Diffstat (limited to 'search')
-rw-r--r--search/categories_cache.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/search/categories_cache.cpp b/search/categories_cache.cpp
index 68b290b5c2..6f6f1c60ec 100644
--- a/search/categories_cache.cpp
+++ b/search/categories_cache.cpp
@@ -42,8 +42,13 @@ CBV CategoriesCache::Load(MwmContext const & context) const
// but the interface of Retrieval forces us to make a choice.
SearchTrieRequest<strings::UniStringDFA> request;
+ // m_categories usually has truncated types; add them together with their subtrees.
m_categories.ForEach([&request, &c](uint32_t const type) {
- request.m_categories.emplace_back(FeatureTypeToString(c.GetIndexForType(type)));
+ c.ForEachInSubtree(
+ [&](uint32_t descendantType) {
+ request.m_categories.emplace_back(FeatureTypeToString(c.GetIndexForType(descendantType)));
+ },
+ type);
});
Retrieval retrieval(context, m_cancellable);