Explorar el Código

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

Alexandre Flament hace 7 años
padre
commit
7ebe3a6f41
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. 6
    3
      searx/results.py

+ 6
- 3
searx/results.py Ver fichero

@@ -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]