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:
authorygorshenin <mipt.vi002@gmail.com>2017-02-14 18:24:32 +0300
committerGitHub <noreply@github.com>2017-02-14 18:24:32 +0300
commit4973685785d668796cbd1e874f9e563b680f9e9b (patch)
treeb1b660142696566f4974ede96a2326aa737b033d /indexer/categories_holder.cpp
parent5fc2b592f17185a8659ce9097bb3d65ceac2e393 (diff)
parent0ddbe71640f6b4b65221761204306711dd0158e1 (diff)
Merge pull request #5412 from mpimenov/categories
[search] Fuzzy search by category.
Diffstat (limited to 'indexer/categories_holder.cpp')
-rw-r--r--indexer/categories_holder.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp
index c3871b2628..4cd965ef1a 100644
--- a/indexer/categories_holder.cpp
+++ b/indexer/categories_holder.cpp
@@ -69,7 +69,7 @@ bool ParseEmoji(CategoriesHolder::Category::Name & name)
return false;
}
- name.m_name = ToUtf8(UniString(1, static_cast<UniChar>(c)));
+ name.m_name = ToUtf8(UniString(1 /* numChars */, static_cast<UniChar>(c)));
if (IsASCIIString(ToUtf8(search::NormalizeAndSimplifyString(name.m_name))))
{
@@ -203,6 +203,8 @@ void CategoriesHolder::AddCategory(Category & cat, vector<uint32_t> & types)
auto const locale = synonym.m_locale;
ASSERT_NOT_EQUAL(locale, kUnsupportedLocaleCode, ());
+ auto const localePrefix = String(1, static_cast<strings::UniChar>(locale));
+
auto const uniName = search::NormalizeAndSimplifyString(synonym.m_name);
vector<String> tokens;
@@ -213,10 +215,7 @@ void CategoriesHolder::AddCategory(Category & cat, vector<uint32_t> & types)
if (!ValidKeyToken(token))
continue;
for (uint32_t const t : types)
- {
- auto it = m_name2type.emplace(locale, make_unique<Trie>()).first;
- it->second->Add(token, t);
- }
+ m_name2type.Add(localePrefix + token, t);
}
}
}
@@ -243,7 +242,7 @@ bool CategoriesHolder::ValidKeyToken(String const & s)
void CategoriesHolder::LoadFromStream(istream & s)
{
m_type2cat.clear();
- m_name2type.clear();
+ m_name2type.Clear();
m_groupTranslations.clear();
State state = EParseTypes;