mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	[fix] KeyError: 'title' in results using key-value.html template
Since #2508 a title is required --> this is a bug when an engine uses the key-value.html template [1], where no title is needed. [1] https://github.com/searxng/searxng/blob/master/searx/templates/simple/result_templates/key-value.html Closes: https://github.com/searxng/searxng/issues/3130 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
		
							parent
							
								
									fcfff92017
								
							
						
					
					
						commit
						df1a774003
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		|  | @ -354,10 +354,13 @@ class ResultContainer: | |||
|         for result in self._merged_results: | ||||
|             score = result_score(result) | ||||
|             result['score'] = score | ||||
| 
 | ||||
|             # removing html content and whitespace duplications | ||||
|             if result.get('content'): | ||||
|                 result['content'] = utils.html_to_text(result['content']).strip() | ||||
|             # removing html content and whitespace duplications | ||||
|             result['title'] = ' '.join(utils.html_to_text(result['title']).strip().split()) | ||||
|             if result.get('title'): | ||||
|                 result['title'] = ' '.join(utils.html_to_text(result['title']).strip().split()) | ||||
| 
 | ||||
|             for result_engine in result['engines']: | ||||
|                 counter_add(score, 'engine', result_engine, 'score') | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Markus Heiser
						Markus Heiser