diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-09-25 11:29:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-25 11:29:13 +0200 |
| commit | 0c3314b33872d68d97d8aede8786a7f56f9831d8 (patch) | |
| tree | b0fc21c13e635af856448ee8985b5907d62aa94c /searx | |
| parent | 636215b1f210a2d490a3d9eecdd1623d7225f3ba (diff) | |
| parent | ab569c1e12672a2d54a51738863b37d2261de5f5 (diff) | |
Merge pull request #344 from dalf/osm-lang-all-fix
[fix] openstreetmap engine: map "all" language to English
Diffstat (limited to 'searx')
| -rw-r--r-- | searx/engines/openstreetmap.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py index 9f1fe94c9..c6211a004 100644 --- a/searx/engines/openstreetmap.py +++ b/searx/engines/openstreetmap.py @@ -42,6 +42,7 @@ route_re = re.compile('(?:from )?(.+) to (.+)') wikidata_image_sparql = """ select ?item ?itemLabel ?image ?sign ?symbol ?website ?wikipediaName where { + hint:Query hint:optimizer "None". values ?item { %WIKIDATA_IDS% } OPTIONAL { ?item wdt:P18|wdt:P8517|wdt:P4291|wdt:P5252|wdt:P3451|wdt:P4640|wdt:P5775|wdt:P2716|wdt:P1801|wdt:P4896 ?image } OPTIONAL { ?item wdt:P1766|wdt:P8505|wdt:P8667 ?sign } @@ -220,6 +221,7 @@ def fetch_wikidata(nominatim_json, user_langage): wd_to_results.setdefault(wd_id, []).append(result) if wikidata_ids: + user_langage = 'en' if user_langage == 'all' else user_langage wikidata_ids_str = " ".join(wikidata_ids) query = wikidata_image_sparql.replace('%WIKIDATA_IDS%', sparql_string_escape(wikidata_ids_str)).replace( '%LANGUAGE%', sparql_string_escape(user_langage) |