commit: c1d9cfd9ae0cc78b91ee5cc339266c26c09e0e4c
parent: 1fcf066a8188b28eb644ea304a131d40b1b341eb
Author: Adam Tauber <asciimoo@gmail.com>
Date: Sun, 2 Aug 2015 19:59:54 +0200
[enh] default settings option to autocomplete backend - #396
Diffstat:
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git 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
@@ -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
@@ -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)