diff options
author | Maxim Pimenov <m@maps.me> | 2017-02-13 18:59:55 +0300 |
---|---|---|
committer | Maxim Pimenov <m@maps.me> | 2017-02-13 19:10:37 +0300 |
commit | a1f4ac5953e858dc4199a54e0eef81fde41ffaa2 (patch) | |
tree | f7502be8382d695d091896882339f724a8256150 /indexer/categories_holder.cpp | |
parent | 5ddc8db2baa8f158f5ed84c09af550f52e50a1ce (diff) |
[indexer] United all tries-by-locale into one trie.
Diffstat (limited to 'indexer/categories_holder.cpp')
-rw-r--r-- | indexer/categories_holder.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp index 382d21f7f9..f4ef385381 100644 --- a/indexer/categories_holder.cpp +++ b/indexer/categories_holder.cpp @@ -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 = make_unique<Trie>(); m_groupTranslations.clear(); State state = EParseTypes; |