summaryrefslogtreecommitdiff
path: root/searx/results.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2024-02-04 09:56:23 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-02-06 07:53:39 +0100
commitdf1a774003c285866a96b149bf92412037b4932d (patch)
tree282ea1ee2fad85a0f8c8392ea1bf36f2298f93b2 /searx/results.py
parentfcfff9201718c7ecda239ee54caef91b70cd2c8f (diff)
downloadsearxng-df1a774003c285866a96b149bf92412037b4932d.tar.gz
searxng-df1a774003c285866a96b149bf92412037b4932d.zip
[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>
Diffstat (limited to 'searx/results.py')
-rw-r--r--searx/results.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/searx/results.py b/searx/results.py
index 471d16981..a941fdfba 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -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')