diff options
author | Yuri Gorshenin <y@maps.me> | 2016-06-20 15:38:26 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2016-06-20 15:38:26 +0300 |
commit | 976712d5e00d2f637a68d3466c8b9a354464f813 (patch) | |
tree | 809a33d0a321bcf78daf1d73f8e9652632e0e2db /search | |
parent | b3bceed6ef7255a94dcf3f48e8a3436c6cd3f806 (diff) |
[search] Fixed search in non-ranked cities/villages.
Diffstat (limited to 'search')
-rw-r--r-- | search/geocoder.cpp | 13 | ||||
-rw-r--r-- | search/search_integration_tests/processor_test.cpp | 17 | ||||
-rwxr-xr-x | search/search_quality/download-maps.sh | 1 |
3 files changed, 24 insertions, 7 deletions
diff --git a/search/geocoder.cpp b/search/geocoder.cpp index 550c104b5b..5db6ec2b62 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -787,7 +787,7 @@ void Geocoder::FillLocalitiesTable() ++numCities; auto const center = feature::GetCenter(ft); - auto const population = ft.GetPopulation(); + auto const population = ftypes::GetPopulation(ft); auto const radius = ftypes::GetRadiusByPopulation(population); City city(l, SearchModel::SEARCH_TYPE_CITY); @@ -837,13 +837,13 @@ void Geocoder::FillVillageLocalities() ++numVillages; City village(l, SearchModel::SEARCH_TYPE_VILLAGE); - auto const population = ft.GetPopulation(); - double const radius = ftypes::GetRadiusByPopulation(population); + auto const population = ftypes::GetPopulation(ft); + auto const radius = ftypes::GetRadiusByPopulation(population); village.m_rect = MercatorBounds::RectByCenterXYAndSizeInMeters(center, radius); #if defined(DEBUG) ft.GetName(StringUtf8Multilang::kDefaultCode, village.m_defaultName); - LOG(LDEBUG, ("Village =", village.m_defaultName, "prob =", village.m_prob)); + LOG(LDEBUG, ("Village =", village.m_defaultName, radius, "prob =", village.m_prob)); #endif m_cities[{l.m_startToken, l.m_endToken}].push_back(village); @@ -1465,10 +1465,14 @@ void Geocoder::FillMissingFieldsInResults() mwmId = id.m_mwmId; mwmHandle = m_index.GetMwmHandleById(mwmId); if (mwmHandle.IsAlive()) + { rankTable = RankTable::Load(mwmHandle.GetValue<MwmValue>()->m_cont); + } else + { rankTable = make_unique<DummyRankTable>(); + } } info.m_rank = rankTable->Get(id.m_index); @@ -1573,7 +1577,6 @@ unique_ptr<coding::CompressedBitVector> Geocoder::LoadVillages(MwmContext & cont { if (!context.m_handle.IsAlive() || !HasSearchIndex(context.m_value)) return make_unique<coding::DenseCBV>(); - return LoadCategories(context, GetVillageCategories()); } diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index 844a33fa1f..ce6a50045d 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -324,13 +324,18 @@ UNIT_CLASS_TEST(ProcessorTest, TestRankingInfo) TestPOI lermontov(m2::PointD(1, 1), "Лермонтовъ", "en"); lermontov.SetTypes({{"amenity", "cafe"}}); - // A city with two noname cafes. - TestCity lermontovo(m2::PointD(-1, -1), "Лермонтово", "en", 100 /* rank */); + // A low-rank city with two noname cafes. + TestCity lermontovo(m2::PointD(-1, -1), "Лермонтово", "en", 0 /* rank */); TestPOI cafe1(m2::PointD(-1.01, -1.01), "", "en"); cafe1.SetTypes({{"amenity", "cafe"}}); TestPOI cafe2(m2::PointD(-0.99, -0.99), "", "en"); cafe2.SetTypes({{"amenity", "cafe"}}); + // A low-rank village with a single noname cafe. + TestVillage pushkino(m2::PointD(-10, -10), "Pushkino", "en", 0 /* rank */); + TestPOI cafe3(m2::PointD(-10.01, -10.01), "", "en"); + cafe3.SetTypes({{"amenity", "cafe"}}); + auto worldId = BuildWorld([&](TestMwmBuilder & builder) { builder.Add(sanFrancisco); @@ -340,9 +345,11 @@ UNIT_CLASS_TEST(ProcessorTest, TestRankingInfo) { builder.Add(cafe1); builder.Add(cafe2); + builder.Add(cafe3); builder.Add(goldenGateBridge); builder.Add(goldenGateStreet); builder.Add(lermontov); + builder.Add(pushkino); builder.Add(waterfall); }); @@ -381,6 +388,12 @@ UNIT_CLASS_TEST(ProcessorTest, TestRankingInfo) TRules rules{ExactMatch(wonderlandId, waterfall)}; TEST(ResultsMatch("waterfall", rules), ()); } + + SetViewport(m2::RectD(m2::PointD(-10.5, -10.5), m2::PointD(-9.5, -9.5))); + { + TRules rules{ExactMatch(wonderlandId, cafe3)}; + TEST(ResultsMatch("cafe pushkino ", rules), ()); + } } UNIT_CLASS_TEST(ProcessorTest, TestHouseNumbers) diff --git a/search/search_quality/download-maps.sh b/search/search_quality/download-maps.sh index a9a63455a7..c87f9b2562 100755 --- a/search/search_quality/download-maps.sh +++ b/search/search_quality/download-maps.sh @@ -51,6 +51,7 @@ fi NAMES=("Australia_Brisbane.mwm" "Belarus_Minsk*.mwm" + "Canada_Ontario_London.mwm" "Canada_Quebek_Montreal.mwm" "Germany_*.mwm" "Russia_*.mwm" |