Browse Source

[enh] better url comparison

asciimoo 11 years ago
parent
commit
326a33fafe
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      searx/engines/__init__.py

+ 3
- 1
searx/engines/__init__.py View File

147
         score = int((flat_len - i)/engines_len)*settings.weights.get(res['engine'], 1)+1
147
         score = int((flat_len - i)/engines_len)*settings.weights.get(res['engine'], 1)+1
148
         duplicated = False
148
         duplicated = False
149
         for new_res in results:
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
             if res['parsed_url'].netloc == new_res['parsed_url'].netloc and\
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
                res['parsed_url'].query == new_res['parsed_url'].query and\
154
                res['parsed_url'].query == new_res['parsed_url'].query and\
153
                res.get('template') == new_res.get('template'):
155
                res.get('template') == new_res.get('template'):
154
                 duplicated = new_res
156
                 duplicated = new_res