mirror of https://github.com/searx/searx
[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".
This commit is contained in:
parent
2fab23ab9a
commit
7d8000d965
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue