mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
[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:
@@ -88,10 +88,12 @@ class ResultContainer:
|
|||||||
if isinstance(result, Result):
|
if isinstance(result, Result):
|
||||||
result.engine = result.engine or engine_name
|
result.engine = result.engine or engine_name
|
||||||
result.normalize_result_fields()
|
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)
|
self.answers.add(result)
|
||||||
elif isinstance(result, MainResult) and self.on_result(result):
|
elif isinstance(result, MainResult):
|
||||||
main_count += 1
|
main_count += 1
|
||||||
self._merge_main_result(result, main_count)
|
self._merge_main_result(result, main_count)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user