From cf8f444e8597bf527ef4bfc691b6d45d5704f77f Mon Sep 17 00:00:00 2001 From: pw3t Date: Sun, 12 Jan 2014 18:31:57 +0100 Subject: [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 --- searx/webapp.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'searx/webapp.py') 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 ) -- cgit v1.2.3 From fdb6fac214c2fb5bdc6c27492bc45c6694483fb4 Mon Sep 17 00:00:00 2001 From: pw3t Date: Mon, 13 Jan 2014 22:24:05 +0100 Subject: [ehn] Add possibility to add icon in results (more ugly html / css, need fix) --- searx/webapp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 72395709c..5fc981a89 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -140,9 +140,14 @@ 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) + for engine in result['engines']: + if engine in ['wikipedia']: + result['favicon'] = engine + featured_results.append(result) + results.remove(result) + elif engine in ['ddg definitions']: + featured_results.append(result) + results.remove(result) if request_data.get('format') == 'json': return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json') -- cgit v1.2.3 From a8ec7fe6a4ad86a8eea4aa6be441984bc5ef7e5a Mon Sep 17 00:00:00 2001 From: pw3t Date: Wed, 15 Jan 2014 22:25:10 +0100 Subject: [ehn] add favicons for vimeo, soundcloud, twitter and youtube --- searx/webapp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 5fc981a89..b26e868f5 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -141,11 +141,9 @@ def index(): result['pretty_url'] = result['url'] for engine in result['engines']: - if engine in ['wikipedia']: - result['favicon'] = engine - featured_results.append(result) - results.remove(result) - elif engine in ['ddg definitions']: + if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter']: + result['favicon'] = engine + if engine in ['wikipedia', 'ddg definitions']: featured_results.append(result) results.remove(result) -- cgit v1.2.3 From d43bd05582c189d8696d58e22c160399ed0b811d Mon Sep 17 00:00:00 2001 From: pw3t Date: Sun, 12 Jan 2014 18:31:57 +0100 Subject: [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 --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index b26e868f5..43bef7db9 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -141,7 +141,7 @@ def index(): result['pretty_url'] = result['url'] for engine in result['engines']: - if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter']: + if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter', 'stackoverflow']: result['favicon'] = engine if engine in ['wikipedia', 'ddg definitions']: featured_results.append(result) -- cgit v1.2.3 From dd1baa6d5894c814625cdf19e71b797ab6354d9c Mon Sep 17 00:00:00 2001 From: pw3t Date: Thu, 16 Jan 2014 21:58:18 +0100 Subject: [fix] replace the png icons by ico's, minor chnage in the html --- searx/webapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 43bef7db9..6bd4e6097 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -141,7 +141,7 @@ def index(): result['pretty_url'] = result['url'] for engine in result['engines']: - if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter', 'stackoverflow']: + if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter', 'stackoverflow', 'github']: result['favicon'] = engine if engine in ['wikipedia', 'ddg definitions']: featured_results.append(result) -- cgit v1.2.3 From 380b440a55ba3b8ec1430843226fa6b4b0dfe289 Mon Sep 17 00:00:00 2001 From: pw3t Date: Thu, 16 Jan 2014 21:58:18 +0100 Subject: [fix] replace the png icons by ico's, minor chnage in the html --- searx/webapp.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index bc534d36b..07db95452 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -144,9 +144,6 @@ def index(): for engine in result['engines']: if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter', 'stackoverflow', 'github']: result['favicon'] = engine - if engine in ['wikipedia', 'ddg definitions']: - featured_results.append(result) - results.remove(result) if request_data.get('format') == 'json': return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json') -- cgit v1.2.3