Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[mod] add category to each results, and change group criterias (template and existing image)

Alexandre Flament7ebe3a6f4120
diff --git a/searx/results.py b/searx/results.py
index b6d408e29..6abffb57a 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -250,9 +250,12 @@ class ResultContainer(object):
for i, res in enumerate(results):
# FIXME : handle more than one category per engine
- category = engines[res['engine']].categories[0] + ':' + ''\
- if 'template' not in res\
- else res['template']
+ res['category'] = engines[res['engine']].categories[0]
+
+ # FIXME : handle more than one category per engine
+ category = engines[res['engine']].categories[0]\
+ + ':' + res.get('template', '')\
+ + ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
current = None if category not in categoryPositions\
else categoryPositions[category]