summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-09-25 11:16:22 +0200
committerAlexandre Flament <alex@al-f.net>2021-09-25 11:16:22 +0200
commitab569c1e12672a2d54a51738863b37d2261de5f5 (patch)
tree7b0cd69070fb00816247ae14216ab8439a0917e9 /searx/engines
parent6f11b61cd5eebd0d9b046be20f4f225803279c67 (diff)
downloadsearxng-ab569c1e12672a2d54a51738863b37d2261de5f5.tar.gz
searxng-ab569c1e12672a2d54a51738863b37d2261de5f5.zip
[fix] openstreetmap engine: optmizer SPARQL query
add hint:Query hint:optimizer "None". to the SPARQL query to keep the response time small. It tells the optimizer to follow the path from ?item to the different property values instead of the other way around. See https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/query_optimization#Property_paths
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/openstreetmap.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py
index 07d536725..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 }