Przeglądaj źródła

[enh] better url comparison

asciimoo 11 lat temu
rodzic
commit
326a33fafe
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3
    1
      searx/engines/__init__.py

+ 3
- 1
searx/engines/__init__.py Wyświetl plik

@@ -147,8 +147,10 @@ def search(query, request, selected_categories):
147 147
         score = int((flat_len - i)/engines_len)*settings.weights.get(res['engine'], 1)+1
148 148
         duplicated = False
149 149
         for new_res in results:
150
+            p1 = res['parsed_url'].path[:-1] if res['parsed_url'].path.endswith('/') else res['parsed_url'].path
151
+            p2 = new_res['parsed_url'].path[:-1] if new_res['parsed_url'].path.endswith('/') else new_res['parsed_url'].path
150 152
             if res['parsed_url'].netloc == new_res['parsed_url'].netloc and\
151
-               res['parsed_url'].path == new_res['parsed_url'].path and\
153
+               p1 == p2 and\
152 154
                res['parsed_url'].query == new_res['parsed_url'].query and\
153 155
                res.get('template') == new_res.get('template'):
154 156
                 duplicated = new_res