From 3b7b852aa82d068b61bba2fdcc6aa03b4d1e62f6 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Tue, 19 Jan 2021 21:29:31 +0100 Subject: [PATCH] [fix] checker: minor fix about language detection --- searx/search/checker/__main__.py | 1 + searx/search/processors/online.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/searx/search/checker/__main__.py b/searx/search/checker/__main__.py index 75b37e6c5..0d7d1b8ed 100644 --- a/searx/search/checker/__main__.py +++ b/searx/search/checker/__main__.py @@ -74,6 +74,7 @@ def run(engine_name_list, verbose): stdout.write(f' {"found languages":15}: {" ".join(sorted(list(checker.test_results.languages)))}\n') for test_name, logs in checker.test_results.logs.items(): for log in logs: + log = map(lambda l: l if isinstance(l, str) else repr(l), log) stdout.write(f' {test_name:15}: {RED}{" ".join(log)}{RESET_SEQ}\n') diff --git a/searx/search/processors/online.py b/searx/search/processors/online.py index 0ceb0adf2..d79edd542 100644 --- a/searx/search/processors/online.py +++ b/searx/search/processors/online.py @@ -239,14 +239,14 @@ class OnlineProcessor(EngineProcessor): 'test': ['unique_results'] } - if getattr(self.engine, 'lang', False): + if getattr(self.engine, 'supported_languages', []): tests['lang_fr'] = { 'matrix': {'query': 'paris', 'lang': 'fr'}, - 'result_container': ['not_empty', ('has_lang', 'fr')], + 'result_container': ['not_empty', ('has_language', 'fr')], } tests['lang_en'] = { 'matrix': {'query': 'paris', 'lang': 'en'}, - 'result_container': ['not_empty', ('has_lang', 'en')], + 'result_container': ['not_empty', ('has_language', 'en')], } if getattr(self.engine, 'safesearch', False):