summaryrefslogtreecommitdiff
path: root/searx/results.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2025-07-28 15:36:26 +0200
committerGitHub <noreply@github.com>2025-07-28 15:36:26 +0200
commit17f2027c4fdc1dc51eaf5710483c70378fe73d26 (patch)
treec99825b4a31ba639f6c780c857769f2f333f7703 /searx/results.py
parent8084a8678430a5442bd421802dca78d862078fbb (diff)
[fix] NotImplementedError raised by ResultContainer (#5058)
If the ``on_result`` handle returns False, then the ``else`` was always jumped to, which throws the NotImplementedError exception:: File "/usr/local/searxng/searxng-src/searx/results.py", line 99, in extend raise NotImplementedError(f"no handler implemented to process the result of type {result}") NotImplementedError: no handler implemented to process the result of type MainResult(title=...
Diffstat (limited to 'searx/results.py')
-rw-r--r--searx/results.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/searx/results.py b/searx/results.py
index 351292f65..8173d85fa 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -88,10 +88,12 @@ class ResultContainer:
if isinstance(result, Result):
result.engine = result.engine or engine_name
result.normalize_result_fields()
+ if not self.on_result(result):
+ continue
- if isinstance(result, BaseAnswer) and self.on_result(result):
+ if isinstance(result, BaseAnswer):
self.answers.add(result)
- elif isinstance(result, MainResult) and self.on_result(result):
+ elif isinstance(result, MainResult):
main_count += 1
self._merge_main_result(result, main_count)
else: