From 5b946910a14dde78c697626459524e46468e37a4 Mon Sep 17 00:00:00 2001 From: tatiana-yan Date: Mon, 28 Sep 2020 19:12:22 +0300 Subject: [PATCH] [search] Prefer result from prevEmit over result with better filterPassed. --- search/pre_ranker.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/search/pre_ranker.cpp b/search/pre_ranker.cpp index cdf9d85863..4c230e7868 100644 --- a/search/pre_ranker.cpp +++ b/search/pre_ranker.cpp @@ -39,11 +39,12 @@ void SweepNearbyResults(double xEps, double yEps, set const & prevEmi auto const & p = results[i].GetInfo().m_center; uint8_t const rank = results[i].GetInfo().m_rank; uint8_t const popularity = results[i].GetInfo().m_popularity; - uint8_t const prevCount = prevEmit.count(results[i].GetId()) ? 1 : 0; uint8_t const exactMatch = results[i].GetInfo().m_exactMatch ? 1 : 0; - // We prefer result which passed the filter even if it has lower rank / popularity / prevCount / - // exactMatch. + // We prefer result which passed the filter even if it has lower rank / popularity / exactMatch. uint8_t const filterPassed = results[i].GetInfo().m_refusedByFilter ? 0 : 2; + // We prefer result from prevEmit over result with better filterPassed because otherwise we have + // lots of blinking results. + uint8_t const prevCount = prevEmit.count(results[i].GetId()) == 0 ? 0 : 3; uint8_t const priority = max({rank, prevCount, popularity, exactMatch}) + filterPassed; sweeper.Add(p.x, p.y, i, priority); }