From c1d9cfd9ae0cc78b91ee5cc339266c26c09e0e4c Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Sun, 2 Aug 2015 19:59:54 +0200 Subject: [PATCH] [enh] default settings option to autocomplete backend - #396 --- searx/settings.yml | 4 ++++ searx/settings_robot.yml | 4 ++++ searx/webapp.py | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/searx/settings.yml b/searx/settings.yml index de018dcb7..ffc3044a5 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -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 diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml index 3ca474d6f..f14443cf5 100644 --- a/searx/settings_robot.yml +++ b/searx/settings_robot.yml @@ -1,6 +1,10 @@ general: debug : False +search: + safe_search : 0 + autocomplete : 0 + server: port : 11111 bind_address : 127.0.0.1 diff --git a/searx/webapp.py b/searx/webapp.py index 778956cce..4292b32d7 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -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)