mirror of https://github.com/searx/searx
[fix] little autocompleter fix
This commit is contained in:
parent
eb6f3348c4
commit
c19b0899a4
|
@ -52,7 +52,7 @@ def searx_bang(full_query):
|
|||
|
||||
# check if query starts with engine name
|
||||
for engine in engines:
|
||||
if engine.startswith(engine_query):
|
||||
if engine.startswith(engine_query.replace('_', ' ')):
|
||||
results.append('!{engine}'.format(engine=engine.replace(' ', '_')))
|
||||
|
||||
# check if query starts with engine shortcut
|
||||
|
@ -86,7 +86,7 @@ def searx_bang(full_query):
|
|||
results.append(':{lang_name}'.format(lang_name=lang_name))
|
||||
|
||||
# check if query starts with country
|
||||
if country.startswith(engine_query):
|
||||
if country.startswith(engine_query.replace('_', ' ')):
|
||||
results.append(':{country}'.format(country=country.replace(' ', '_')))
|
||||
|
||||
# remove duplicates
|
||||
|
|
|
@ -355,6 +355,8 @@ def autocompleter():
|
|||
# parse searx specific autocompleter results like !bang
|
||||
raw_results = searx_bang(query)
|
||||
|
||||
# normal autocompletion results only appear if max 3. searx results returned
|
||||
if len(raw_results) <= 3:
|
||||
# run autocompletion
|
||||
raw_results.extend(completer(query.getSearchQuery()))
|
||||
|
||||
|
|
Loading…
Reference in New Issue