From da7b069d6ebf5cb07b7b8bd9ab1ee1ca8c78e1de Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 7 Mar 2025 17:35:26 +0100 Subject: [fix] plugins: bugfix of tor_check and unit_converter Closes: https://github.com/searxng/searxng/issues/4461 Signed-off-by: Markus Heiser --- searx/plugins/unit_converter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'searx/plugins/unit_converter.py') diff --git a/searx/plugins/unit_converter.py b/searx/plugins/unit_converter.py index cdd8287fe..3b9f98945 100644 --- a/searx/plugins/unit_converter.py +++ b/searx/plugins/unit_converter.py @@ -25,7 +25,7 @@ import babel.numbers from flask_babel import gettext, get_locale from searx import data -from searx.result_types import Answer +from searx.result_types import EngineResults name = "Unit converter plugin" @@ -245,8 +245,8 @@ def _parse_text_and_convert(from_query, to_query) -> str | None: return f'{result} {target_symbol}' -def post_search(_request, search) -> list[Answer]: - results = [] +def post_search(_request, search) -> EngineResults: + results = EngineResults() # only convert between units on the first page if search.search_query.pageno > 1: @@ -264,6 +264,6 @@ def post_search(_request, search) -> list[Answer]: from_query, to_query = query.split(keyword, 1) target_val = _parse_text_and_convert(from_query.strip(), to_query.strip()) if target_val: - Answer(results=results, answer=target_val) + results.add(results.types.Answer(answer=target_val)) return results -- cgit v1.2.3