This commit is contained in:
crimean 2018-11-28 18:16:46 +03:00
parent f56044a3b6
commit f6ff93bd5b

View file

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