mirror of
https://github.com/searxng/searxng.git
synced 2024-11-06 01:19:31 +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
1 changed files with 5 additions and 2 deletions
|
@ -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 a new issue