diff options
author | Dalf <alex@al-f.net> | 2019-07-27 08:35:21 +0200 |
---|---|---|
committer | Dalf <alex@al-f.net> | 2019-07-27 08:52:30 +0200 |
commit | 70a01e5f024c8845d6ee049c4d0ebd1bf73625ea (patch) | |
tree | 9e0ddedb39a40dbddc3d36a33870960c8de48d81 /searx/results.py | |
parent | 23611897ec2c7ff7f930ff6608eaa25d0fb27ca6 (diff) | |
download | searxng-70a01e5f024c8845d6ee049c4d0ebd1bf73625ea.tar.gz searxng-70a01e5f024c8845d6ee049c4d0ebd1bf73625ea.zip |
[fix] don't merge image results if the img_src is different
Diffstat (limited to 'searx/results.py')
-rw-r--r-- | searx/results.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/searx/results.py b/searx/results.py index d3f2ecd0d..be74a836b 100644 --- a/searx/results.py +++ b/searx/results.py @@ -212,11 +212,20 @@ class ResultContainer(object): # check for duplicates duplicated = False + result_template = result.get('template') for merged_result in self._merged_results: if compare_urls(result['parsed_url'], merged_result['parsed_url'])\ - and result.get('template') == merged_result.get('template'): - duplicated = merged_result - break + and result_template == merged_result.get('template'): + if result_template != 'images.html': + # not an image, same template, same url : it's a duplicate + duplicated = merged_result + break + else: + # it's an image + # it's a duplicate if the parsed_url, template and img_src are differents + if result.get('img_src', '') == merged_result.get('img_src', ''): + duplicated = merged_result + break # merge duplicates together if duplicated: |