|
|
@ -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):
|
|
|
|
def get_search_query_from_webapp(preferences, form):
|
|
|
|
# no text for the query ?
|
|
|
|
# no text for the query ?
|
|
|
|
if not form.get('q'):
|
|
|
|
if not form.get('q'):
|
|
|
@ -328,6 +335,8 @@ def get_search_query_from_webapp(preferences, form):
|
|
|
|
for engine in categories[categ]
|
|
|
|
for engine in categories[categ]
|
|
|
|
if (engine.name, categ) not in disabled_engines)
|
|
|
|
if (engine.name, categ) not in disabled_engines)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query_engines = deduplicate_query_engines(query_engines)
|
|
|
|
|
|
|
|
|
|
|
|
return (SearchQuery(query, query_engines, query_categories,
|
|
|
|
return (SearchQuery(query, query_engines, query_categories,
|
|
|
|
query_lang, query_safesearch, query_pageno, query_time_range),
|
|
|
|
query_lang, query_safesearch, query_pageno, query_time_range),
|
|
|
|
raw_text_query)
|
|
|
|
raw_text_query)
|
|
|
|