From d889826bcc0a7e604a2e7d365207d509ed503dcc Mon Sep 17 00:00:00 2001 From: tatiana-yan Date: Thu, 9 Jul 2020 11:04:44 +0300 Subject: [PATCH] [search] Add alt/old name in braces when search result is matched by alt/old name. --- search/ranker.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/search/ranker.cpp b/search/ranker.cpp index e2d473f406..39594ce7c0 100644 --- a/search/ranker.cpp +++ b/search/ranker.cpp @@ -756,6 +756,7 @@ void Ranker::MakeRankerResults(Geocoder::Params const & geocoderParams, void Ranker::GetBestMatchName(FeatureType & f, string & name) const { + int8_t bestLang; KeywordLangMatcher::Score bestScore; auto updateScore = [&](int8_t lang, string const & s, bool force) { // Ignore name for categorial requests. @@ -764,6 +765,7 @@ void Ranker::GetBestMatchName(FeatureType & f, string & name) const { bestScore = score; name = s; + bestLang = lang; } }; @@ -780,6 +782,14 @@ void Ranker::GetBestMatchName(FeatureType & f, string & name) const } }; UNUSED_VALUE(f.ForEachName(bestNameFinder)); + + if (bestLang == StringUtf8Multilang::kAltNameCode || + bestLang == StringUtf8Multilang::kOldNameCode) + { + string readableName; + f.GetReadableName(readableName); + name = readableName + " (" + name + ")"; + } } void Ranker::MatchForSuggestions(strings::UniString const & token, int8_t locale,