Browse Source

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

Alexandre Flament 7 years ago
parent
commit
7ebe3a6f41
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      searx/results.py

+ 6
- 3
searx/results.py View File

250
 
250
 
251
         for i, res in enumerate(results):
251
         for i, res in enumerate(results):
252
             # FIXME : handle more than one category per engine
252
             # FIXME : handle more than one category per engine
253
-            category = engines[res['engine']].categories[0] + ':' + ''\
254
-                if 'template' not in res\
255
-                else res['template']
253
+            res['category'] = engines[res['engine']].categories[0]
254
+
255
+            # FIXME : handle more than one category per engine
256
+            category = engines[res['engine']].categories[0]\
257
+                + ':' + res.get('template', '')\
258
+                + ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
256
 
259
 
257
             current = None if category not in categoryPositions\
260
             current = None if category not in categoryPositions\
258
                 else categoryPositions[category]
261
                 else categoryPositions[category]