summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorpw3t <romain@berthor.fr>2014-01-12 18:31:57 +0100
committerpw3t <romain@berthor.fr>2014-01-16 22:03:43 +0100
commitcf8f444e8597bf527ef4bfc691b6d45d5704f77f (patch)
tree6ae1cff9ae2e888251df151f97d882a1fe9008a9 /searx/webapp.py
parentad72c16050932ac5c71e27e4199582b5de38b561 (diff)
downloadsearxng-cf8f444e8597bf527ef4bfc691b6d45d5704f77f.tar.gz
searxng-cf8f444e8597bf527ef4bfc691b6d45d5704f77f.zip
[ehn] Add a 'featured result feature'm putting on top of the reasults ddg definitions and wikipedia (ugly html / css)
[ehn] Add a templates for videos, so the thumbnails all have the same side
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 48448eb25..72395709c 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -125,6 +125,7 @@ def index():
results, suggestions = search(query, request, selected_engines)
+ featured_results = []
for result in results:
if request_data.get('format', 'html') == 'html':
if 'content' in result:
@@ -139,6 +140,10 @@ def index():
else:
result['pretty_url'] = result['url']
+ if 'wikipedia' in result['engines'] or 'ddg definitions' in result['engines']:
+ featured_results.append(result)
+ results.remove(result)
+
if request_data.get('format') == 'json':
return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json')
elif request_data.get('format') == 'csv':
@@ -167,7 +172,8 @@ def index():
,results=results
,q=request_data['q']
,selected_categories=selected_categories
- ,number_of_results=len(results)
+ ,number_of_results=len(results)+len(featured_results)
+ ,featured_results=featured_results
,suggestions=suggestions
)