Display alternative names for streets
This commit is contained in:
parent
f6d4b62555
commit
51d9605cde
1 changed files with 19 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue