[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: general:
debug : False # Debug mode, only for development 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: server:
port : 8888 port : 8888
bind_address : "127.0.0.1" # address to listen on bind_address : "127.0.0.1" # address to listen on

View file

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

View file

@ -263,7 +263,7 @@ def image_proxify(url):
def render(template_name, override_theme=None, **kwargs): def render(template_name, override_theme=None, **kwargs):
blocked_engines = get_blocked_engines(engines, request.cookies) 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: if autocomplete not in autocomplete_backends:
autocomplete = None autocomplete = None
@ -491,7 +491,7 @@ def autocompleter():
return '', 400 return '', 400
# run autocompleter # 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 # parse searx specific autocompleter results like !bang
raw_results = searx_bang(query) raw_results = searx_bang(query)