瀏覽代碼

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

Alexandre Flament 7 年之前
父節點
當前提交
7ebe3a6f41
共有 1 個檔案被更改,包括 6 行新增3 行删除
  1. 6
    3
      searx/results.py

+ 6
- 3
searx/results.py 查看文件

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