diff --git a/search/search_integration_tests/search_query_v2_test.cpp b/search/search_integration_tests/search_query_v2_test.cpp index 1f830c10f0..e7c08342e9 100644 --- a/search/search_integration_tests/search_query_v2_test.cpp +++ b/search/search_integration_tests/search_query_v2_test.cpp @@ -307,9 +307,10 @@ UNIT_TEST(SearchQueryV2_SearchInWorld) auto const result = engine.RegisterMap(testWorld); TEST_EQUAL(result.second, MwmSet::RegResult::Success, ()); - auto worldId = result.first; + auto const worldId = result.first; m2::RectD const viewport(m2::PointD(-1.0, -1.0), m2::PointD(-0.5, -0.5)); + { TestSearchRequest request(engine, "Los Alamos", "en", search::SearchParams::ALL, viewport); request.Wait(); diff --git a/search/v2/geocoder.cpp b/search/v2/geocoder.cpp index 6e6d36dd0b..c49b9a50d5 100644 --- a/search/v2/geocoder.cpp +++ b/search/v2/geocoder.cpp @@ -337,8 +337,8 @@ Geocoder::Geocoder(Index & index, storage::CountryInfoGetter const & infoGetter) , m_numTokens(0) , m_model(SearchModel::Instance()) , m_streets(nullptr) - , m_matcher(nullptr) , m_villages(nullptr) + , m_matcher(nullptr) , m_finder(static_cast(*this)) , m_lastMatchedRegion(nullptr) , m_results(nullptr) @@ -484,7 +484,7 @@ void Geocoder::GoImpl(vector> & infos, bool inViewport) m_context = move(context); MY_SCOPE_GUARD(cleanup, [&]() { - LOG(LDEBUG, (m_context->GetName(), "processing complete.")); + LOG(LDEBUG, (m_context->GetName(), "geocoding complete.")); m_matcher->OnQueryFinished(); m_matcher = nullptr; m_context.reset(); @@ -853,15 +853,15 @@ void Geocoder::MatchRegions(RegionType type) // On the World.mwm we need to check that CITY - STATE - COUNTRY // form a nested sequence. Otherwise, as mwm borders do not // intersect state or country boundaries, it's enough to check - // that the currently processing mwm belongs to region. + // mwm that is currently being processed belongs to region. if (isWorld) { matches = m_lastMatchedRegion == nullptr || m_infoGetter.IsBelongToRegions(region.m_center, m_lastMatchedRegion->m_ids); } - else if (m_infoGetter.IsBelongToRegions(fileName, region.m_ids)) + else { - matches = true; + matches = m_infoGetter.IsBelongToRegions(fileName, region.m_ids); } if (!matches) @@ -925,9 +925,7 @@ void Geocoder::MatchCities() if (m_context->GetInfo()->GetType() == MwmInfo::WORLD) continue; - // Unites features from all localities and uses the resulting bit - // vector as a filter for features retrieved during geocoding. - auto const * cityFeatures = RetrieveGeometryFeatures(*m_context, city.m_rect, CITY_ID); + auto const * cityFeatures = RetrieveGeometryFeatures(*m_context, city.m_rect, city.m_featureId); if (coding::CompressedBitVector::IsEmpty(cityFeatures)) continue; @@ -1103,7 +1101,7 @@ void Geocoder::MatchPOIsAndBuildings(size_t curToken) feature.ParseTypes(); SearchModel::SearchType const searchType = m_model.GetSearchType(feature); - // All SEARCH_TYPE_CITY features were filtered in DoGeocodingWithLocalities(). + // All SEARCH_TYPE_CITY features were filtered in MatchCities(). // All SEARCH_TYPE_STREET features were filtered in GreedilyMatchStreets(). if (searchType < SearchModel::SEARCH_TYPE_STREET) clusters[searchType].push_back(featureId); @@ -1124,7 +1122,7 @@ void Geocoder::MatchPOIsAndBuildings(size_t curToken) for (size_t i = 0; i < ARRAY_SIZE(clusters); ++i) { // ATTENTION: DO NOT USE layer after recursive calls to - // DoGeocoding(). This may lead to use-after-free. + // MatchPOIsAndBuildings(). This may lead to use-after-free. auto & layer = m_layers.back(); layer.m_sortedFeatures = &clusters[i]; diff --git a/search/v2/geocoder.hpp b/search/v2/geocoder.hpp index 0f69d37f5b..88053b7fa7 100644 --- a/search/v2/geocoder.hpp +++ b/search/v2/geocoder.hpp @@ -136,9 +136,8 @@ private: enum { - VIEWPORT_ID, - POSITION_ID, - CITY_ID + VIEWPORT_ID = -1, + POSITION_ID = -2, }; SearchQueryParams::TSynonymsVector const & GetTokens(size_t i) const;