diff --git a/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java index 32bca1d208..ac43c28dba 100644 --- a/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/net/osmand/search/core/SearchCoreFactory.java @@ -41,6 +41,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; @@ -356,6 +357,15 @@ public class SearchCoreFactory { if (!phrase.getNameStringMatcher().matches(stripBraces(sr.localeName))) { sr.priorityDistance = 5; } + String searchTextLower = phrase.getUnknownSearchWord().toLowerCase(); + if (!Algorithms.isEmpty(searchTextLower) && !sr.localeName.toLowerCase().contains(searchTextLower)) { + for (String otherName : sr.otherNames) { + if (otherName.toLowerCase().contains(searchTextLower)) { + sr.localeName = sr.localeName + " (" + otherName + ")"; + break; + } + } + } sr.objectType = ObjectType.STREET; sr.localeRelatedObjectName = ((Street)object).getCity().getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate()); sr.relatedObject = ((Street)object).getCity(); @@ -866,6 +876,15 @@ public class SearchCoreFactory { && !(nm.matches(res.localeName) || nm.matches(res.otherNames))) { continue; } + String searchTextLower = phrase.getUnknownSearchWord().toLowerCase(); + if (!Algorithms.isEmpty(searchTextLower) && !res.localeName.toLowerCase().contains(searchTextLower)) { + for (String otherName : res.otherNames) { + if (otherName.toLowerCase().contains(searchTextLower)) { + res.localeName = res.localeName + " (" + otherName + ")"; + break; + } + } + } res.localeRelatedObjectName = c.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate()); res.object = object; res.preferredZoom = 17;