forked from organicmaps/organicmaps-tmp
[new downloader] Review fixes.
This commit is contained in:
parent
4854a207f5
commit
acc9dc2a5e
2 changed files with 21 additions and 18 deletions
|
@ -1071,10 +1071,24 @@ bool Framework::Search(search::SearchParams const & params)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Framework::GetGroupCountryIdFromFeature(FeatureType const & ft, string & name) const
|
||||
{
|
||||
static const vector<int8_t> langIndices =
|
||||
{ StringUtf8Multilang::GetLangIndex("en"), FeatureType::DEFAULT_LANG,
|
||||
StringUtf8Multilang::kInternationalCode };
|
||||
|
||||
for (auto const langIndex : langIndices)
|
||||
{
|
||||
if (!ft.GetName(langIndex, name))
|
||||
continue;
|
||||
if (Storage().IsCoutryIdCountryTreeInnerNode(name))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Framework::SearchInDownloader(DownloaderSearchParams const & params)
|
||||
{
|
||||
static const int8_t kEngIndex = StringUtf8Multilang::GetLangIndex("en");
|
||||
|
||||
search::SearchParams searchParam;
|
||||
searchParam.m_query = params.m_query;
|
||||
searchParam.m_inputLocale = params.m_inputLocale;
|
||||
|
@ -1099,23 +1113,10 @@ bool Framework::SearchInDownloader(DownloaderSearchParams const & params)
|
|||
|
||||
if (type == ftypes::COUNTRY || type == ftypes::STATE)
|
||||
{
|
||||
auto pushIfFound = [&](int8_t index)
|
||||
{
|
||||
string name;
|
||||
if (!ft.GetName(index, name))
|
||||
return false;
|
||||
|
||||
if (Storage().IsCoutryIdCountryTreeInnerNode(name))
|
||||
{
|
||||
downloaderSearchResults.m_results.emplace_back(name, it->GetString() /* m_matchedName */);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if (pushIfFound(kEngIndex) || pushIfFound(FeatureType::DEFAULT_LANG)
|
||||
|| pushIfFound(StringUtf8Multilang::kInternationalCode))
|
||||
string groupFeatureName;
|
||||
if (GetGroupCountryIdFromFeature(ft, groupFeatureName))
|
||||
{
|
||||
downloaderSearchResults.m_results.emplace_back(groupFeatureName, it->GetString() /* m_matchedName */);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,6 +214,7 @@ public:
|
|||
//@}
|
||||
|
||||
storage::Storage & Storage() { return m_storage; }
|
||||
storage::Storage const & Storage() const { return m_storage; }
|
||||
storage::CountryInfoGetter & CountryInfoGetter() { return *m_infoGetter; }
|
||||
|
||||
/// @name Bookmarks, Tracks and other UserMarks
|
||||
|
@ -389,6 +390,7 @@ private:
|
|||
|
||||
void OnUpdateGpsTrackPointsCallback(vector<pair<size_t, location::GpsTrackInfo>> && toAdd,
|
||||
pair<size_t, size_t> const & toRemove);
|
||||
bool GetGroupCountryIdFromFeature(FeatureType const & ft, string & name) const;
|
||||
|
||||
public:
|
||||
using TSearchRequest = search::QuerySaver::TSearchRequest;
|
||||
|
|
Loading…
Add table
Reference in a new issue