mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	only return one url per "type" in Wikidata (#2151)
i.e. only one official website, one Twitter, etc.
This commit is contained in:
		
							parent
							
								
									079783e993
								
							
						
					
					
						commit
						0d8970c8f2
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -382,7 +382,7 @@ def add_attribute(attributes, id_cache, property_id, default_label=None, date=Fa | ||||||
| 
 | 
 | ||||||
| # requires property_id unless it's a wiki link (defined in link_type) | # requires property_id unless it's a wiki link (defined in link_type) | ||||||
| def add_url(urls, result, id_cache, property_id=None, default_label=None, url_prefix=None, results=None, | def add_url(urls, result, id_cache, property_id=None, default_label=None, url_prefix=None, results=None, | ||||||
|             link_type=None): |             link_type=None, only_first=True): | ||||||
|     links = [] |     links = [] | ||||||
| 
 | 
 | ||||||
|     # wiki links don't have property in wikidata page |     # wiki links don't have property in wikidata page | ||||||
|  | @ -421,6 +421,8 @@ def add_url(urls, result, id_cache, property_id=None, default_label=None, url_pr | ||||||
|             urls.append(u) |             urls.append(u) | ||||||
|             if results is not None: |             if results is not None: | ||||||
|                 results.append(u) |                 results.append(u) | ||||||
|  |             if only_first: | ||||||
|  |                 break | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_imdblink(result, url_prefix): | def get_imdblink(result, url_prefix): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Marc Abonce Seguin
						Marc Abonce Seguin