summaryrefslogtreecommitdiff
path: root/searx/autocomplete.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/autocomplete.py')
-rw-r--r--searx/autocomplete.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py
index e37d34d71..9d31aa36f 100644
--- a/searx/autocomplete.py
+++ b/searx/autocomplete.py
@@ -35,33 +35,34 @@ def searx_bang(full_query):
results = []
# check if current query stats with !bang
- if full_query.getSearchQuery()[0] == '!':
+ first_char = full_query.getSearchQuery()[0]
+ if first_char == '!' or first_char == '?':
if len(full_query.getSearchQuery()) == 1:
# show some example queries
# TODO, check if engine is not avaliable
- results.append("!images")
- results.append("!wikipedia")
- results.append("!osm")
+ results.append(first_char + "images")
+ results.append(first_char + "wikipedia")
+ results.append(first_char + "osm")
else:
engine_query = full_query.getSearchQuery()[1:]
# check if query starts with categorie name
for categorie in categories:
if categorie.startswith(engine_query):
- results.append('!{categorie}'.format(categorie=categorie))
+ results.append(first_char+'{categorie}'.format(categorie=categorie))
# check if query starts with engine name
for engine in engines:
if engine.startswith(engine_query.replace('_', ' ')):
- results.append('!{engine}'.format(engine=engine.replace(' ', '_')))
+ results.append(first_char+'{engine}'.format(engine=engine.replace(' ', '_')))
# check if query starts with engine shortcut
for engine_shortcut in engine_shortcuts:
if engine_shortcut.startswith(engine_query):
- results.append('!{engine_shortcut}'.format(engine_shortcut=engine_shortcut))
+ results.append(first_char+'{engine_shortcut}'.format(engine_shortcut=engine_shortcut))
# check if current query stats with :bang
- elif full_query.getSearchQuery()[0] == ':':
+ elif first_char == ':':
if len(full_query.getSearchQuery()) == 1:
# show some example queries
results.append(":en")