diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-04-16 20:53:43 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-04-17 01:09:34 +0300 |
commit | ed11084e2807aaa29e6bacb9b1327ccf3d221e87 (patch) | |
tree | 7bc2435273d1b3c28d2a64da0f576a95b296ce5d /indexer | |
parent | 216a9961e67238b8c2517122d81c70669e38fe5d (diff) |
[indexer] Leave the most important types in FeatureParams::FinishAddingTypes()
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/feature_data.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 6c7eadec10..5f90c2b32b 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -177,7 +177,7 @@ void TypesHolder::SortBySpec() // Put "very common" types to the end of possible PP-description types. static UselessTypesChecker checker; - UNUSED_VALUE(base::RemoveIfKeepValid(begin(), end(), [](uint32_t t) { return checker(t); })); + UNUSED_VALUE(base::RemoveIfKeepValid(begin(), end(), checker)); } vector<string> TypesHolder::ToObjectNames() const @@ -496,14 +496,18 @@ bool FeatureParams::FinishAddingTypes() newTypes.push_back(candidate); } - // Remove duplicated types. - sort(newTypes.begin(), newTypes.end()); - newTypes.erase(unique(newTypes.begin(), newTypes.end()), newTypes.end()); + base::SortUnique(newTypes); - m_types.swap(newTypes); + if (newTypes.size() > kMaxTypesCount) + { + // Put common types to the end to leave the most important types. + static UselessTypesChecker checker; + UNUSED_VALUE(base::RemoveIfKeepValid(newTypes.begin(), newTypes.end(), checker)); + newTypes.resize(kMaxTypesCount); + sort(newTypes.begin(), newTypes.end()); + } - if (m_types.size() > kMaxTypesCount) - m_types.resize(kMaxTypesCount); + m_types.swap(newTypes); // Patch fix that removes house number from localities. if (!house.IsEmpty() && ftypes::IsLocalityChecker::Instance()(m_types)) |