Bläddra i källkod

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

Alexandre Flament 7 år sedan
förälder
incheckning
7ebe3a6f41
1 ändrade filer med 6 tillägg och 3 borttagningar
  1. 6
    3
      searx/results.py

+ 6
- 3
searx/results.py Visa fil

@@ -250,9 +250,12 @@ class ResultContainer(object):
250 250
 
251 251
         for i, res in enumerate(results):
252 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 260
             current = None if category not in categoryPositions\
258 261
                 else categoryPositions[category]