[enh] default settings option to autocomplete backend - #396

This commit is contained in:
Adam Tauber 2015-08-02 19:59:54 +02:00
parent 1fcf066a81
commit c1d9cfd9ae
3 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,10 @@
general:
debug : False # Debug mode, only for development
search:
safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default
server:
port : 8888
bind_address : "127.0.0.1" # address to listen on

View File

@ -1,6 +1,10 @@
general:
debug : False
search:
safe_search : 0
autocomplete : 0
server:
port : 11111
bind_address : 127.0.0.1

View File

@ -263,7 +263,7 @@ def image_proxify(url):
def render(template_name, override_theme=None, **kwargs):
blocked_engines = get_blocked_engines(engines, request.cookies)
autocomplete = request.cookies.get('autocomplete')
autocomplete = request.cookies.get('autocomplete', settings['search']['autocomplete'])
if autocomplete not in autocomplete_backends:
autocomplete = None
@ -491,7 +491,7 @@ def autocompleter():
return '', 400
# run autocompleter
completer = autocomplete_backends.get(request.cookies.get('autocomplete'))
completer = autocomplete_backends.get(request.cookies.get('autocomplete', settings['search']['autocomplete']))
# parse searx specific autocompleter results like !bang
raw_results = searx_bang(query)