summaryrefslogtreecommitdiff
path: root/searx/search.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/search.py')
-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)