diff options
author | Yuri Gorshenin <y@maps.me> | 2016-06-16 17:25:36 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2016-06-17 14:19:33 +0300 |
commit | 683250079ac00a81920ed9cc101239cee4ed2f9c (patch) | |
tree | a0fce36270da4e4f4daf1bddd0b6e0b0bf8b7a37 /indexer/search_string_utils.cpp | |
parent | 01db5017dca8ee1179b157918e47b181062c466c (diff) |
[search] Fixed streets matching.
Diffstat (limited to 'indexer/search_string_utils.cpp')
-rw-r--r-- | indexer/search_string_utils.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/indexer/search_string_utils.cpp b/indexer/search_string_utils.cpp index 24aaaa3764..ade404f93d 100644 --- a/indexer/search_string_utils.cpp +++ b/indexer/search_string_utils.cpp @@ -223,4 +223,27 @@ bool ContainsNormalized(string const & str, string const & substr) UniString const usubstr = NormalizeAndSimplifyString(substr); return std::search(ustr.begin(), ustr.end(), usubstr.begin(), usubstr.end()) != ustr.end(); } + +// StreetTokensFilter ------------------------------------------------------------------------------ +void StreetTokensFilter::Put(strings::UniString const & token, bool isPrefix, size_t tag) +{ + if ((isPrefix && IsStreetSynonymPrefix(token)) || (!isPrefix && IsStreetSynonym(token))) + { + ++m_numSynonyms; + if (m_numSynonyms == 1) + { + m_delayedToken = token; + m_delayedTag = tag; + } + else + { + EmitToken(m_delayedToken, m_delayedTag); + EmitToken(token, tag); + } + } + else + { + EmitToken(token, tag); + } +} } // namespace search |