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:
authorcc-engineering <13055392+cc-engineering@users.noreply.github.com>2019-03-11 12:27:34 +0300
committerGitHub <noreply@github.com>2019-03-11 12:27:34 +0300
commitf14daaf49d28dd176443ce94815fcc292f6bde20 (patch)
treeccee2719c7112d693356ed50d310165836f08ac6 /geocoder
parent3b54a319bf064f2b2cb6ca91f9470351b4a8cf8a (diff)
parent334baf3f3d27b4320446daefa446cff959450299 (diff)
Merge pull request #10491 from cc-engineering/geocoder.street-suffix-optimization
[geocoder] Optimize CPU: no index street synonym only
Diffstat (limited to 'geocoder')
-rw-r--r--geocoder/index.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/geocoder/index.cpp b/geocoder/index.cpp
index 80142569e7..ae47e36e1c 100644
--- a/geocoder/index.cpp
+++ b/geocoder/index.cpp
@@ -89,11 +89,25 @@ void Index::AddStreet(DocId const & docId, Index::Doc const & doc)
{
CHECK_EQUAL(doc.m_type, Type::Street, ());
size_t const t = static_cast<size_t>(doc.m_type);
+
+ auto isStreetSynonym = [] (string const & s) {
+ return search::IsStreetSynonym(strings::MakeUniString(s));
+ };
+
+ if (all_of(begin(doc.m_address[t]), end(doc.m_address[t]), isStreetSynonym))
+ {
+ LOG(LDEBUG, ("Undefined proper name in tokens", doc.m_address[t], "of street entry",
+ doc.m_osmId, "(", doc.m_address, ")"));
+ if (doc.m_address[t].size() > 1)
+ m_docIdsByTokens[MakeIndexKey(doc.m_address[t])].emplace_back(docId);
+ return;
+ }
+
m_docIdsByTokens[MakeIndexKey(doc.m_address[t])].emplace_back(docId);
for (size_t i = 0; i < doc.m_address[t].size(); ++i)
{
- if (!search::IsStreetSynonym(strings::MakeUniString(doc.m_address[t][i])))
+ if (!isStreetSynonym(doc.m_address[t][i]))
continue;
auto addr = doc.m_address[t];
addr.erase(addr.begin() + i);