forked from organicmaps/organicmaps-tmp
[search] Use ftypes::IsLocalityChecker instead of TypesSkepper::IsCountryOrState
This commit is contained in:
parent
0af4cf356e
commit
ab2a1f25a3
3 changed files with 9 additions and 18 deletions
|
@ -320,6 +320,13 @@ public:
|
|||
|
||||
static TypesSkipper skipIndex;
|
||||
|
||||
auto const isCountryOrState = [](auto types) {
|
||||
auto const & isLocalityChecker = ftypes::IsLocalityChecker::Instance();
|
||||
auto const localityType = isLocalityChecker.GetType(types);
|
||||
return localityType == ftypes::LocalityType::Country ||
|
||||
localityType == ftypes::LocalityType::State;
|
||||
};
|
||||
|
||||
feature::TypesHolder types(f);
|
||||
|
||||
auto const & streetChecker = ftypes::IsStreetOrSuburbChecker::Instance();
|
||||
|
@ -327,9 +334,8 @@ public:
|
|||
|
||||
// Init inserter with serialized value.
|
||||
// Insert synonyms only for countries and states (maybe will add cities in future).
|
||||
FeatureNameInserter<Key, Value> inserter(
|
||||
index, skipIndex.IsCountryOrState(types) ? m_synonyms : nullptr, m_keyValuePairs,
|
||||
hasStreetType);
|
||||
FeatureNameInserter<Key, Value> inserter(index, isCountryOrState(types) ? m_synonyms : nullptr,
|
||||
m_keyValuePairs, hasStreetType);
|
||||
|
||||
string const postcode = f.GetMetadata().Get(feature::Metadata::FMD_POSTCODE);
|
||||
if (!postcode.empty())
|
||||
|
|
|
@ -59,19 +59,6 @@ void TypesSkipper::SkipEmptyNameTypes(feature::TypesHolder & types) const
|
|||
types.RemoveIf(shouldBeRemoved);
|
||||
}
|
||||
|
||||
bool TypesSkipper::IsCountryOrState(feature::TypesHolder const & types) const
|
||||
{
|
||||
auto static const country = classif().GetTypeByPath({"place", "country"});
|
||||
auto static const state = classif().GetTypeByPath({"place", "state"});
|
||||
for (uint32_t t : types)
|
||||
{
|
||||
ftype::TruncValue(t, 2);
|
||||
if (t == country || t == state)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
bool TypesSkipper::HasType(Cont const & v, uint32_t t)
|
||||
{
|
||||
|
|
|
@ -16,8 +16,6 @@ public:
|
|||
|
||||
void SkipEmptyNameTypes(feature::TypesHolder & types) const;
|
||||
|
||||
bool IsCountryOrState(feature::TypesHolder const & types) const;
|
||||
|
||||
private:
|
||||
using Cont = buffer_vector<uint32_t, 16>;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue