mirror of https://github.com/searxng/searxng.git
Add '?' bang to the autocompleter
This commit is contained in:
parent
fecac90e88
commit
bc2d5bf88c
|
@ -35,13 +35,14 @@ def searx_bang(full_query):
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
# check if current query stats with !bang
|
# 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:
|
if len(full_query.getSearchQuery()) == 1:
|
||||||
# show some example queries
|
# show some example queries
|
||||||
# TODO, check if engine is not avaliable
|
# TODO, check if engine is not avaliable
|
||||||
results.append("!images")
|
results.append(first_char + "images")
|
||||||
results.append("!wikipedia")
|
results.append(first_char + "wikipedia")
|
||||||
results.append("!osm")
|
results.append(first_char + "osm")
|
||||||
else:
|
else:
|
||||||
engine_query = full_query.getSearchQuery()[1:]
|
engine_query = full_query.getSearchQuery()[1:]
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ def searx_bang(full_query):
|
||||||
results.append('!{engine_shortcut}'.format(engine_shortcut=engine_shortcut))
|
results.append('!{engine_shortcut}'.format(engine_shortcut=engine_shortcut))
|
||||||
|
|
||||||
# check if current query stats with :bang
|
# check if current query stats with :bang
|
||||||
elif full_query.getSearchQuery()[0] == ':':
|
elif first_char == ':':
|
||||||
if len(full_query.getSearchQuery()) == 1:
|
if len(full_query.getSearchQuery()) == 1:
|
||||||
# show some example queries
|
# show some example queries
|
||||||
results.append(":en")
|
results.append(":en")
|
||||||
|
|
Loading…
Reference in New Issue