diff options
author | Adam Tauber <asciimoo@gmail.com> | 2015-01-25 22:52:48 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2015-01-25 22:52:48 +0100 |
commit | 78081baa8fa311c052f41f3d39e3cb0a30b539f1 (patch) | |
tree | ad84481f4bda3960d697cae68eef173ba2dd2b5f /searx/webapp.py | |
parent | 516ea9b76901532337d1171c6c72bb98dc6d4431 (diff) | |
download | searxng-78081baa8fa311c052f41f3d39e3cb0a30b539f1.tar.gz searxng-78081baa8fa311c052f41f3d39e3cb0a30b539f1.zip |
[enh] always enable inner autocompletition (server side only)
Diffstat (limited to 'searx/webapp.py')
-rw-r--r-- | searx/webapp.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 00761404e..65f70b0ea 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -429,34 +429,29 @@ def autocompleter(): # run autocompleter completer = autocomplete_backends.get(request.cookies.get('autocomplete')) - # check if valid autocompleter is selected - if not completer: - return '', 400 - # 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: + # normal autocompletion results only appear if max 3 inner results returned + if len(raw_results) <= 3 and completer: # run autocompletion raw_results.extend(completer(query.getSearchQuery())) # parse results (write :language and !engine back to result string) results = [] for result in raw_results: - result_query = query - result_query.changeSearchQuery(result) + query.changeSearchQuery(result) # add parsed result - results.append(result_query.getFullQuery()) + results.append(query.getFullQuery()) # return autocompleter results if request_data.get('format') == 'x-suggestions': return Response(json.dumps([query.query, results]), mimetype='application/json') - else: - return Response(json.dumps(results), - mimetype='application/json') + + return Response(json.dumps(results), + mimetype='application/json') @app.route('/preferences', methods=['GET', 'POST']) |