Revert "Fix #6137"

This reverts commit f6ff93bd5b.
This commit is contained in:
crimean 2018-12-04 12:11:31 +03:00
parent caefb19440
commit 0d4a3d5214

View file

@ -664,15 +664,12 @@ public class SearchCoreFactory {
List<AbstractPoiType> results = new ArrayList<AbstractPoiType>(); List<AbstractPoiType> results = new ArrayList<AbstractPoiType>();
NameStringMatcher nm = NameStringMatcher nm =
new NameStringMatcher(phrase.getUnknownSearchPhrase(), StringMatcherMode.CHECK_ONLY_STARTS_WITH_TRIM); new NameStringMatcher(phrase.getUnknownSearchPhrase(), StringMatcherMode.CHECK_ONLY_STARTS_WITH_TRIM);
Set<String> filters = new HashSet<>();
for (AbstractPoiType pf : topVisibleFilters) { for (AbstractPoiType pf : topVisibleFilters) {
if (!phrase.isUnknownSearchWordPresent() if (!phrase.isUnknownSearchWordPresent()
|| nm.matches(pf.getTranslation()) || nm.matches(pf.getTranslation())
|| nm.matches(pf.getEnTranslation()) || nm.matches(pf.getEnTranslation())
|| nm.matches(pf.getSynonyms())) { || nm.matches(pf.getSynonyms())) {
results.add(pf); results.add(pf);
filters.add(pf.getTranslation());
} }
} }
if (phrase.isUnknownSearchWordPresent()) { if (phrase.isUnknownSearchWordPresent()) {
@ -682,7 +679,6 @@ public class SearchCoreFactory {
|| nm.matches(c.getEnTranslation()) || nm.matches(c.getEnTranslation())
|| nm.matches(c.getSynonyms()))) { || nm.matches(c.getSynonyms()))) {
results.add(c); results.add(c);
filters.add(c.getTranslation());
} }
} }
Iterator<Entry<String, PoiType>> it = translatedNames.entrySet().iterator(); Iterator<Entry<String, PoiType>> it = translatedNames.entrySet().iterator();
@ -690,7 +686,7 @@ public class SearchCoreFactory {
Entry<String, PoiType> e = it.next(); Entry<String, PoiType> e = it.next();
PoiType pt = e.getValue(); PoiType pt = e.getValue();
if (pt.getCategory() != types.getOtherMapCategory()) { if (pt.getCategory() != types.getOtherMapCategory()) {
if (!results.contains(pt) && !filters.contains(pt.getTranslation()) if (!results.contains(pt)
&& (nm.matches(pt.getEnTranslation()) && (nm.matches(pt.getEnTranslation())
|| nm.matches(pt.getTranslation()) || nm.matches(pt.getTranslation())
|| nm.matches(pt.getSynonyms()))) { || nm.matches(pt.getSynonyms()))) {