diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java index 1ca6ea04ad4..478ba84e7bd 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java @@ -1125,6 +1125,7 @@ private TopIndexMatch matchTopIndex(BinaryMapIndexReader r, SearchPhrase phrase) List poiSubTypes = r.getTopIndexSubTypes(); String lang = phrase.getSettings().getLang(); List matches = new ArrayList<>(); + Collator collator = OsmAndCollator.primaryCollator(); NameStringMatcher nm = new NameStringMatcher(search, CHECK_ONLY_STARTS_WITH); for (PoiSubType subType : poiSubTypes) { String topIndexValue = null; @@ -1133,14 +1134,13 @@ private TopIndexMatch matchTopIndex(BinaryMapIndexReader r, SearchPhrase phrase) Collections.sort(possibleValues); for (String s : possibleValues) { translate = getTopIndexTranslation(s); + String normalizeBrand = s.toLowerCase(Locale.ROOT); if (complete) { - CollatorStringMatcher csm = new CollatorStringMatcher(s, StringMatcherMode.CHECK_ONLY_STARTS_WITH); - if (csm.matches(search)) { + if (CollatorStringMatcher.cmatches(collator, search, normalizeBrand, StringMatcherMode.CHECK_ONLY_STARTS_WITH)) { topIndexValue = s; break; } else { - csm = new CollatorStringMatcher(translate, StringMatcherMode.CHECK_ONLY_STARTS_WITH); - if (csm.matches(search)) { + if (CollatorStringMatcher.cmatches(collator, search, translate, StringMatcherMode.CHECK_ONLY_STARTS_WITH)) { topIndexValue = s; break; } @@ -1172,7 +1172,7 @@ private TopIndexMatch matchTopIndex(BinaryMapIndexReader r, SearchPhrase phrase) private String getTopIndexTranslation(String value) { String key = TopIndexFilter.getValueKey(value); String translate = types.getPoiTranslation(key); - if (translate.toLowerCase().equals(key)) { + if (translate.toLowerCase(Locale.ROOT).equals(key)) { translate = value; } return translate;