diff options
author | Anatoly Serdtcev <serdtcev@maps.me> | 2019-02-01 20:45:04 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2019-02-04 13:55:58 +0300 |
commit | d4dee5663c338d1e0352fe9f7d6c4c5a9225248c (patch) | |
tree | b39141606ee216ac4e96f0ec0c752d695d07280f /geocoder | |
parent | faeee82dd69f54b3265d14a64f9cc985467ba0a9 (diff) |
[geocoder] Fix for review
Diffstat (limited to 'geocoder')
-rw-r--r-- | geocoder/geocoder.cpp | 4 | ||||
-rw-r--r-- | geocoder/index.cpp | 16 | ||||
-rw-r--r-- | geocoder/index.hpp | 14 |
3 files changed, 17 insertions, 17 deletions
diff --git a/geocoder/geocoder.cpp b/geocoder/geocoder.cpp index ae008bd693..71af43ae7a 100644 --- a/geocoder/geocoder.cpp +++ b/geocoder/geocoder.cpp @@ -302,9 +302,9 @@ void Geocoder::FillBuildingsLayer(Context & ctx, Tokens const & subquery, Layer // let's stay on the safer side and set the house number bit. ctx.SetHouseNumberBit(); - for (auto const & streetDocId : layer.m_entries) + for (auto const & docId : layer.m_entries) { - m_index.ForEachBuildingOnStreet(streetDocId, [&](Index::DocId const & buildingDocId) { + m_index.ForEachRelatedBuilding(docId, [&](Index::DocId const & buildingDocId) { auto const & bld = m_index.GetDoc(buildingDocId); auto const bt = static_cast<size_t>(Type::Building); auto const & realHN = MakeHouseNumber(bld.m_address[bt]); diff --git a/geocoder/index.cpp b/geocoder/index.cpp index e18a1ab6e1..e6dfcce2aa 100644 --- a/geocoder/index.cpp +++ b/geocoder/index.cpp @@ -102,21 +102,21 @@ void Index::AddHouses() auto const & street = buildingDoc.m_address[static_cast<size_t>(Type::Street)]; auto const & locality = buildingDoc.m_address[static_cast<size_t>(Type::Locality)]; - Tokens const * buildingPlace = nullptr; + Tokens const * relationName = nullptr; if (!street.empty()) - buildingPlace = &street; + relationName = &street; else if (!locality.empty()) - buildingPlace = &locality; + relationName = &locality; - if (!buildingPlace) + if (!relationName) continue; - ForEachDocId(*buildingPlace, [&](DocId const & placeCandidate) { - auto const & streetDoc = GetDoc(placeCandidate); - if (streetDoc.IsParentTo(buildingDoc)) + ForEachDocId(*relationName, [&](DocId const & candidate) { + auto const & candidateDoc = GetDoc(candidate); + if (candidateDoc.IsParentTo(buildingDoc)) { - m_buildingsOnStreet[placeCandidate].emplace_back(docId); + m_relatedBuildings[candidate].emplace_back(docId); ++numIndexed; if (numIndexed % kLogBatch == 0) diff --git a/geocoder/index.hpp b/geocoder/index.hpp index 8a56fb4271..6f23fe39af 100644 --- a/geocoder/index.hpp +++ b/geocoder/index.hpp @@ -41,12 +41,12 @@ public: } // Calls |fn| for DocIds of buildings that are located on the - // street whose DocId is |streetDocId|. + // street/locality whose DocId is |docId|. template <typename Fn> - void ForEachBuildingOnStreet(DocId const & streetDocId, Fn && fn) const + void ForEachRelatedBuilding(DocId const & docId, Fn && fn) const { - auto const it = m_buildingsOnStreet.find(streetDocId); - if (it == m_buildingsOnStreet.end()) + auto const it = m_relatedBuildings.find(docId); + if (it == m_relatedBuildings.end()) return; for (DocId const & docId : it->second) @@ -65,14 +65,14 @@ private: // with and without synonyms of the word "street". void AddStreet(DocId const & docId, Doc const & e); - // Fills the |m_buildingsOnStreet| field. + // Fills the |m_relatedBuildings| field. void AddHouses(); std::vector<Doc> const & m_docs; std::unordered_map<std::string, std::vector<DocId>> m_docIdsByTokens; - // Lists of houses grouped by the streets they belong to. - std::unordered_map<DocId, std::vector<DocId>> m_buildingsOnStreet; + // Lists of houses grouped by the streets/localities they belong to. + std::unordered_map<DocId, std::vector<DocId>> m_relatedBuildings; }; } // namespace geocoder |