[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=...
This commit is contained in:
Markus Heiser 2025-07-28 15:36:26 +02:00 committed by GitHub
parent 8084a86784
commit 17f2027c4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: