mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 01:36:29 +00:00
[fix] don't merge image results if the img_src is different
This commit is contained in:
parent
23611897ec
commit
70a01e5f02
1 changed files with 12 additions and 3 deletions
|
@ -212,11 +212,20 @@ class ResultContainer(object):
|
||||||
|
|
||||||
# check for duplicates
|
# check for duplicates
|
||||||
duplicated = False
|
duplicated = False
|
||||||
|
result_template = result.get('template')
|
||||||
for merged_result in self._merged_results:
|
for merged_result in self._merged_results:
|
||||||
if compare_urls(result['parsed_url'], merged_result['parsed_url'])\
|
if compare_urls(result['parsed_url'], merged_result['parsed_url'])\
|
||||||
and result.get('template') == merged_result.get('template'):
|
and result_template == merged_result.get('template'):
|
||||||
duplicated = merged_result
|
if result_template != 'images.html':
|
||||||
break
|
# 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
|
# merge duplicates together
|
||||||
if duplicated:
|
if duplicated:
|
||||||
|
|
Loading…
Reference in a new issue