Fix search with brand

This commit is contained in:
Victor Shcherb 2018-05-10 14:01:47 +02:00
parent b0b8bec02f
commit c006e7897b
4 changed files with 15 additions and 2 deletions

View file

@ -549,7 +549,8 @@ public class BinaryMapPoiReaderAdapter {
if (!matches) { if (!matches) {
Map<String, String> lt = am.getAdditionalInfo(); Map<String, String> lt = am.getAdditionalInfo();
for (Entry<String, String> e : lt.entrySet()) { for (Entry<String, String> e : lt.entrySet()) {
if(!e.getKey().contains("_name")) { if(!e.getKey().contains("_name") &&
!e.getKey().equals("brand")) {
continue; continue;
} }
matches = matcher.matches(e.getValue()); matches = matcher.matches(e.getValue());

View file

@ -59,6 +59,9 @@ public class EntityParser {
if (mo.getName().length() == 0) { if (mo.getName().length() == 0) {
setNameFromRef(mo, tags); setNameFromRef(mo, tags);
} }
if (mo.getName().length() == 0) {
setNameFromBrand(mo, tags);
}
} }
/** /**
@ -120,6 +123,13 @@ public class EntityParser {
} }
} }
private static void setNameFromBrand(MapObject mo, Map<String, String> tags) {
String ref = tags.get(OSMTagKey.BRAND.getValue());
if(ref != null){
mo.setName(ref);
}
}
private static void setNameFromOperator(MapObject mo, Map<String, String> tags) { private static void setNameFromOperator(MapObject mo, Map<String, String> tags) {
String op = tags.get(OSMTagKey.OPERATOR.getValue()); String op = tags.get(OSMTagKey.OPERATOR.getValue());
if (op == null) if (op == null)

View file

@ -24,6 +24,7 @@ public class OSMSettings {
// transport // transport
ROUTE("route"), //$NON-NLS-1$ ROUTE("route"), //$NON-NLS-1$
ROUTE_MASTER("route_master"), //$NON-NLS-1$ ROUTE_MASTER("route_master"), //$NON-NLS-1$
BRAND("brand"), //$NON-NLS-1$
OPERATOR("operator"), //$NON-NLS-1$ OPERATOR("operator"), //$NON-NLS-1$
REF("ref"), //$NON-NLS-1$ REF("ref"), //$NON-NLS-1$
RCN_REF("rcn_ref"), //$NON-NLS-1$ RCN_REF("rcn_ref"), //$NON-NLS-1$

View file

@ -525,7 +525,8 @@ public class SearchCoreFactory {
sr.otherNames = object.getAllNames(true); sr.otherNames = object.getAllNames(true);
sr.localeName = object.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate()); sr.localeName = object.getName(phrase.getSettings().getLang(), phrase.getSettings().isTransliterate());
if (phrase.isUnknownSearchWordComplete()) { if (phrase.isUnknownSearchWordComplete()) {
if(!nm.matches(sr.localeName) && !nm.matches(sr.otherNames)) { if(!nm.matches(sr.localeName) && !nm.matches(sr.otherNames) &&
!nm.matches(object.getAdditionalInfo().values())) {
return false; return false;
} }
} }