summaryrefslogtreecommitdiff
path: root/searx/search.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/search.py')
-rw-r--r--searx/search.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/searx/search.py b/searx/search.py
index bb440352b..1bf05f7f9 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -23,6 +23,7 @@ from operator import itemgetter
from Queue import Queue
from time import time
from urlparse import urlparse, unquote
+from searx import settings
from searx.engines import (
categories, engines
)
@@ -205,6 +206,10 @@ def score_results(results):
# if there is no duplicate found, append result
else:
res['score'] = score
+ # if the result has no scheme, use http as default
+ if res['parsed_url'].scheme == '':
+ res['parsed_url'] = res['parsed_url']._replace(scheme="http")
+
results.append(res)
results = sorted(results, key=itemgetter('score'), reverse=True)
@@ -480,9 +485,9 @@ class Search(object):
try:
# 0 = None, 1 = Moderate, 2 = Strict
- request_params['safesearch'] = int(request.cookies.get('safesearch', 1))
- except ValueError:
- request_params['safesearch'] = 1
+ request_params['safesearch'] = int(request.cookies.get('safesearch'))
+ except Exception:
+ request_params['safesearch'] = settings['search']['safe_search']
# update request parameters dependent on
# search-engine (contained in engines folder)