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(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(Type::Street)]; auto const & locality = buildingDoc.m_address[static_cast(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 - 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 const & m_docs; std::unordered_map> m_docIdsByTokens; - // Lists of houses grouped by the streets they belong to. - std::unordered_map> m_buildingsOnStreet; + // Lists of houses grouped by the streets/localities they belong to. + std::unordered_map> m_relatedBuildings; }; } // namespace geocoder