summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorDalf <alex@al-f.net>2019-07-26 08:51:04 +0200
committerDalf <alex@al-f.net>2019-07-27 08:52:30 +0200
commit7d8000d9654f9fa9a051a5feceba2b429ea23a08 (patch)
treed6325507138e98f643963dcb2373eba2826779c8 /searx
parent2fab23ab9a9288fb2ca4e9fb094075410b0995d3 (diff)
[fix] "!wp !wp test" send only one request to wikipedia.
Note that "!general !wp test" is not fixed because the category for "!wp" is "none".
Diffstat (limited to 'searx')
-rw-r--r--searx/search.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/searx/search.py b/searx/search.py
index 465b5ce64..1472073bd 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -198,6 +198,13 @@ def default_request_params():
}
+# remove duplicate queries.
+# FIXME: does not fix "!music !soundcloud", because the categories are 'none' and 'music'
+def deduplicate_query_engines(query_engines):
+ uniq_query_engines = {q["category"] + '|' + q["name"]: q for q in query_engines}
+ return uniq_query_engines.values()
+
+
def get_search_query_from_webapp(preferences, form):
# no text for the query ?
if not form.get('q'):
@@ -328,6 +335,8 @@ def get_search_query_from_webapp(preferences, form):
for engine in categories[categ]
if (engine.name, categ) not in disabled_engines)
+ query_engines = deduplicate_query_engines(query_engines)
+
return (SearchQuery(query, query_engines, query_categories,
query_lang, query_safesearch, query_pageno, query_time_range),
raw_text_query)