[search][ranking] Removed "small plus diff" in name match over category match.

Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
Viktor Govako 2024-04-09 08:54:20 -03:00 committed by Viktor Havaka
parent 4f96ee22e7
commit a4c8d97089
2 changed files with 37 additions and 9 deletions

View file

@ -96,8 +96,7 @@ static_assert(std::size(kPoiType) == base::E2I(PoiType::Count));
// - See NY_Subway test.
double constexpr kFalseCats =
kNameScore[base::E2I(NameScore::FULL_PREFIX)] - kNameScore[base::E2I(NameScore::FULL_MATCH)] +
kPoiType[base::E2I(PoiType::PureCategory)] - kPoiType[base::E2I(PoiType::Eat)]
+ AbsPenaltyPerKm(); // a small 'plus diff' to keep fast food a little bit higher
kPoiType[base::E2I(PoiType::PureCategory)] - kPoiType[base::E2I(PoiType::Eat)];
static_assert(kFalseCats < 0.0);
double constexpr kStreetType[] = {
@ -472,7 +471,7 @@ Model::Type RankingInfo::GetTypeScore() const
PoiType RankingInfo::GetPoiTypeScore() const
{
// Equalize all *pure category* results to not distinguish different toilets (see NY_Subway, ToiletAirport test).
// Equalize all *pure category* results to not distinguish different toilets (see ToiletAirport test).
return (m_pureCats ? PoiType::PureCategory : m_classifType.poi);
}

View file

@ -224,19 +224,48 @@ UNIT_CLASS_TEST(MwmTestsFixture, TopPOIs_Smoke)
// https://github.com/organicmaps/organicmaps/issues/2133
UNIT_CLASS_TEST(MwmTestsFixture, NY_Subway)
{
auto const & cl = classif();
size_t constexpr kTopResults = kPopularPoiResultsCount;
// New York
ms::LatLon const center(40.7355019, -73.9948155);
SetViewportAndLoadMaps(center);
auto request = MakeRequest("subway");
{
auto request = MakeRequest("subway");
auto const & results = request->Results();
TEST_GREATER(results.size(), kTopResults, ());
/// @todo Equal food and metro results, so test 2 food on top.
Range const top10(results, 0, kTopResults);
TEST_EQUAL(CountClassifType(top10, cl.GetTypeByPath({"amenity", "fast_food"})), 2, ());
TEST_GREATER(CountClassifType(top10, cl.GetTypeByPath({"railway", "station", "subway"})), 6, ());
}
{
auto request = MakeRequest("subway food");
auto const & results = request->Results();
TEST_GREATER(results.size(), kTopResults, ());
EqualClassifType(Range(results, 0, kTopResults), GetClassifTypes({{"amenity", "fast_food"}}));
}
}
UNIT_CLASS_TEST(MwmTestsFixture, Paris_Hotel)
{
auto const & cl = classif();
// Paris
ms::LatLon const center(48.8568049, 2.3515878);
SetViewportAndLoadMaps(center);
auto request = MakeRequest("hotel");
auto const & results = request->Results();
TEST_GREATER(results.size(), kPopularPoiResultsCount, ());
/// @todo First result is building-train_station with 'subway' in name;
// - 5 nearby 'subway' fast-foods;
// - 3 railway-station-subway;
EqualClassifType(Range(results, 1, 6), GetClassifTypes({{"amenity", "fast_food"}}));
EqualClassifType(Range(results, 6, 9), GetClassifTypes({{"railway", "station", "subway"}}));
/// @todo Ok to have post office, car repair, library on top with "hotel" name?
// Test at least some nearby hotels (3).
Range const top10(results, 0, kPopularPoiResultsCount);
TEST_GREATER(CountClassifType(top10, cl.GetTypeByPath({"tourism", "hotel"})), 2, ());
}
// https://github.com/organicmaps/organicmaps/issues/3249