diff options
author | vng <viktor.govako@gmail.com> | 2013-02-21 23:52:39 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:51:22 +0300 |
commit | 9db034bade3b1c5f3e4bd7769f37f48c8c4355dc (patch) | |
tree | 518c8b0efa96eb0ebeafbded1c3519c49f2e1486 /indexer | |
parent | f4a9517f296862ee33899a8a5d3542d50b8075fc (diff) |
Store reference to type index instead of raw type in mwm search index.
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/categories_holder.hpp | 11 | ||||
-rw-r--r-- | indexer/search_index_builder.cpp | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/indexer/categories_holder.hpp b/indexer/categories_holder.hpp index ab62ca0d21..e756aab61e 100644 --- a/indexer/categories_holder.hpp +++ b/indexer/categories_holder.hpp @@ -34,11 +34,12 @@ public: private: typedef strings::UniString StringT; - typedef multimap<uint32_t, shared_ptr<Category> > ContainerT; - typedef ContainerT::const_iterator IteratorT; + typedef multimap<uint32_t, shared_ptr<Category> > Type2CategoryContT; + typedef multimap<StringT, uint32_t> Name2CatContT; + typedef Type2CategoryContT::const_iterator IteratorT; - multimap<uint32_t, shared_ptr<Category> > m_type2cat; - multimap<StringT, uint32_t> m_name2type; + Type2CategoryContT m_type2cat; + Name2CatContT m_name2type; public: CategoriesHolder() {} @@ -65,7 +66,7 @@ public: template <class ToDo> void ForEachTypeByName(StringT const & name, ToDo toDo) const { - typedef typename multimap<StringT, uint32_t>::const_iterator IterT; + typedef typename Name2CatContT::const_iterator IterT; pair<IterT, IterT> range = m_name2type.equal_range(name); while (range.first != range.second) diff --git a/indexer/search_index_builder.cpp b/indexer/search_index_builder.cpp index 16cc651df8..42aa6cd47a 100644 --- a/indexer/search_index_builder.cpp +++ b/indexer/search_index_builder.cpp @@ -336,6 +336,8 @@ public: if (types.Empty()) return; + Classificator const & c = classif(); + // add names of categories of the feature for (size_t i = 0; i < types.Size(); ++i) { @@ -354,7 +356,8 @@ public: if (my::between_s(m_scales.first, m_scales.second, r.first) || my::between_s(m_scales.first, m_scales.second, r.second)) { - inserter.AddToken(search::CATEGORIES_LANG, search::FeatureTypeToString(type)); + inserter.AddToken(search::CATEGORIES_LANG, + search::FeatureTypeToString(c.GetIndexForType(type))); } } } |