[search] Correctly initialize region and city for all search result types.

This commit is contained in:
Alex Zolotarev 2016-03-16 19:07:42 +03:00 committed by Sergey Yershov
parent 9680304f5a
commit ee56f209d4

View file

@ -1292,6 +1292,17 @@ search::AddressInfo Framework::GetSearchResultAddress(search::Result const & res
if (res.IsSuggest())
return info;
string const & type = res.GetFeatureType();
if (!type.empty())
info.m_types.push_back(type);
// Assign name if it's not equal with type.
string const & name = res.GetString();
if (name != type)
info.m_name = name;
info.m_city = res.GetRegion();
/// @todo Optimize here according to the fact that feature is
/// already read in many cases during search results processing.
auto const & id = res.GetFeatureID();
@ -1308,17 +1319,6 @@ search::AddressInfo Framework::GetSearchResultAddress(search::Result const & res
}
info = GetAddressInfoAtPoint(res.GetFeatureCenter());
string const & type = res.GetFeatureType();
if (!type.empty())
info.m_types.push_back(type);
// Assign name if it's not equal with type.
string const & name = res.GetString();
if (name != type)
info.m_name = name;
info.m_city = res.GetRegion();
return info;
}