Fix "Local wikipedia results don't show in search history"

This commit is contained in:
nazar-kutz 2020-11-20 17:20:59 +02:00
parent 10c2478153
commit 212dbdb8ff
2 changed files with 6 additions and 15 deletions

View file

@ -205,20 +205,6 @@ public class MapPoiTypes {
if (pt != null && !pt.isReference()) {
return pt;
}
if (pc.isWiki() && name.startsWith(WIKI_LANG)) {
return getPoiTypeForWiki(pc, name);
}
}
return null;
}
public AbstractPoiType getPoiTypeForWiki(PoiCategory osmwiki, String name) {
for (PoiType pt : osmwiki.getPoiTypes()) {
for (PoiType wikiLangPt : pt.getPoiAdditionals()) {
if (wikiLangPt != null && Algorithms.objectEquals(wikiLangPt.getOsmTag(), name)) {
return wikiLangPt;
}
}
}
return null;
}

View file

@ -436,7 +436,12 @@ public class QuickSearchHelper implements ResourceListener {
SearchResult sr = new SearchResult(phrase);
PointDescription pd = point.getName();
if (pd.isPoiType()) {
AbstractPoiType pt = MapPoiTypes.getDefault().getAnyPoiTypeByKey(pd.getName());
String name = pd.getName();
MapPoiTypes mapPoiTypes = MapPoiTypes.getDefault();
AbstractPoiType pt = mapPoiTypes.getAnyPoiTypeByKey(name);
if (pt == null) {
pt = mapPoiTypes.getAnyPoiAdditionalTypeByKey(name);
}
if (pt != null) {
sr.localeName = pt.getTranslation();
sr.object = pt;