summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2019-07-16 11:08:36 +0200
committerGitHub <noreply@github.com>2019-07-16 11:08:36 +0200
commitddee4861cee8d5b08e9219d4e727acc35fc3ca32 (patch)
tree3ad42e60342e90d577c1f83c5e726665163a4a7d /searx/webapp.py
parentf750df871318c435c40c7d910e5dcd47b350e73d (diff)
parent4d38b8bef7de16f741d20839ee5d31a48d499f81 (diff)
Merge pull request #1630 from MarcAbonce/bang_fixes
[fix] Small fixes with bangs in queries
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 8290b6822..4c983509d 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -584,6 +584,7 @@ def index():
'results.html',
results=results,
q=request.form['q'],
+ query_prefix=u''.join((request.form['q']).rsplit(search_query.query.decode('utf-8'), 1)),
selected_categories=search_query.categories,
pageno=search_query.pageno,
time_range=search_query.time_range,
@@ -636,8 +637,11 @@ def autocompleter():
# parse searx specific autocompleter results like !bang
raw_results = searx_bang(raw_text_query)
- # normal autocompletion results only appear if max 3 inner results returned
- if len(raw_results) <= 3 and completer:
+ # normal autocompletion results only appear if no inner results returned
+ # and there is a query part besides the engine and language bangs
+ if len(raw_results) == 0 and completer and (len(raw_text_query.query_parts) > 1 or
+ (len(raw_text_query.languages) == 0 and
+ not raw_text_query.specific)):
# get language from cookie
language = request.preferences.get_value('language')
if not language or language == 'all':