diff options
| author | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-03-20 15:39:17 +0100 |
|---|---|---|
| committer | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-03-20 15:39:17 +0100 |
| commit | cc7f3cb61798463036a886ae5f0ccd06aca5e625 (patch) | |
| tree | e48ff073d1b50d8ffe471840f0ca8f437610fc0c /searx/webapp.py | |
| parent | 360543dec4b652950c67a7f1cc4027ee1b920a30 (diff) | |
initial implemention of autocompletion in opensearch.xml
Diffstat (limited to 'searx/webapp.py')
| -rw-r--r-- | searx/webapp.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index e818ae710..3034b2153 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -233,10 +233,17 @@ def autocompleter(): # TODO fix XSS-vulnerability, remove test code autocompleter.querry = request_data.get('q') - autocompleter.results = [autocompleter.querry] - - return Response(json.dumps(autocompleter.results), - mimetype='application/json') + autocompleter.results = [] + + if autocompleter.querry: + autocompleter.results = [autocompleter.querry + "-searx",autocompleter.querry + " asfded",autocompleter.querry + " asdf"] + + if request_data.get('format') == 'x-suggestions': + return Response(json.dumps([autocompleter.querry,autocompleter.results]), + mimetype='application/json') + else: + return Response(json.dumps(autocompleter.results), + mimetype='application/json') @app.route('/preferences', methods=['GET', 'POST']) |