on master help sign in
[enh] better url comparison
commit326a33fafeaade21cc97cea1fe5e50c0dbea40d5 authorasciimoo <asciimoo@gmail.com> dateSat 2 Nov 2013, 18:07 (13 years ago) parentcd268f9
1 file changed+3−1
searx/engines/__init__.py+3−1
searx/engines/__init__.py+3−1
@@ -147,8 +147,10 @@ def search(query, request, selected_categories):
147147 score = int((flat_len - i)/engines_len)*settings.weights.get(res['engine'], 1)+1
148148 duplicated = False
149149 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
150152 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\
152154 res['parsed_url'].query == new_res['parsed_url'].query and\
153155 res.get('template') == new_res.get('template'):
154156 duplicated = new_res