mirror of
https://github.com/searxng/searxng
synced 2024-11-16 21:25:37 +00: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
@ -354,10 +354,13 @@ class ResultContainer:
|
|||||||
for result in self._merged_results:
|
for result in self._merged_results:
|
||||||
score = result_score(result)
|
score = result_score(result)
|
||||||
result['score'] = score
|
result['score'] = score
|
||||||
|
|
||||||
|
# removing html content and whitespace duplications
|
||||||
if result.get('content'):
|
if result.get('content'):
|
||||||
result['content'] = utils.html_to_text(result['content']).strip()
|
result['content'] = utils.html_to_text(result['content']).strip()
|
||||||
# removing html content and whitespace duplications
|
if result.get('title'):
|
||||||
result['title'] = ' '.join(utils.html_to_text(result['title']).strip().split())
|
result['title'] = ' '.join(utils.html_to_text(result['title']).strip().split())
|
||||||
|
|
||||||
for result_engine in result['engines']:
|
for result_engine in result['engines']:
|
||||||
counter_add(score, 'engine', result_engine, 'score')
|
counter_add(score, 'engine', result_engine, 'score')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user