[search] Add country name synonyms to downloaderSearchCallback.

This commit is contained in:
tatiana-yan 2019-05-24 16:29:10 +03:00 committed by mpimenov
parent f7f16ef9df
commit cb487d007a

View file

@ -20,6 +20,7 @@ namespace
bool GetGroupCountryIdFromFeature(storage::Storage const & storage, FeatureType & ft,
std::string & name)
{
auto const & synonyms = storage.GetCountryNameSynonyms();
int8_t const langIndices[] = {StringUtf8Multilang::kEnglishCode,
StringUtf8Multilang::kDefaultCode,
StringUtf8Multilang::kInternationalCode};
@ -30,6 +31,13 @@ bool GetGroupCountryIdFromFeature(storage::Storage const & storage, FeatureType
continue;
if (storage.IsInnerNode(name))
return true;
auto const it = synonyms.find(name);
if (it == synonyms.end())
continue;
if (!storage.IsInnerNode(it->second))
continue;
name = it->second;
return true;
}
return false;
}