From a2badb4fe47eaa6df26b7bc0ef601cb9179edc3a Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 1 Aug 2022 16:42:33 +0200 Subject: [PATCH] [doc] add description of method EngineProcessor.get_params() Signed-off-by: Markus Heiser --- searx/search/processors/abstract.py | 7 +++++++ searx/search/processors/online_currency.py | 3 +++ searx/search/processors/online_dictionary.py | 2 ++ searx/search/processors/online_url_search.py | 3 +++ 4 files changed, 15 insertions(+) diff --git a/searx/search/processors/abstract.py b/searx/search/processors/abstract.py index d4822fc56..d74616db0 100644 --- a/searx/search/processors/abstract.py +++ b/searx/search/processors/abstract.py @@ -138,6 +138,13 @@ class EngineProcessor(ABC): return False def get_params(self, search_query, engine_category): + """Returns a set of *request params* or ``None`` if request is not supported. + + Not supported conditions (``None`` is returned): + + - A page-number > 1 when engine does not support paging. + - A time range when the engine does not support time range. + """ # if paging is not supported, skip if search_query.pageno > 1 and not self.engine.paging: return None diff --git a/searx/search/processors/online_currency.py b/searx/search/processors/online_currency.py index 6bd891b1d..92398239f 100644 --- a/searx/search/processors/online_currency.py +++ b/searx/search/processors/online_currency.py @@ -38,6 +38,9 @@ class OnlineCurrencyProcessor(OnlineProcessor): engine_type = 'online_currency' def get_params(self, search_query, engine_category): + """Returns a set of *request params* or ``None`` if search query does not match + to :py:obj:`parser_re`.""" + params = super().get_params(search_query, engine_category) if params is None: return None diff --git a/searx/search/processors/online_dictionary.py b/searx/search/processors/online_dictionary.py index 77540de9a..fbfc9df8e 100644 --- a/searx/search/processors/online_dictionary.py +++ b/searx/search/processors/online_dictionary.py @@ -18,6 +18,8 @@ class OnlineDictionaryProcessor(OnlineProcessor): engine_type = 'online_dictionary' def get_params(self, search_query, engine_category): + """Returns a set of *request params* or ``None`` if search query does not match + to :py:obj:`parser_re`.""" params = super().get_params(search_query, engine_category) if params is None: return None diff --git a/searx/search/processors/online_url_search.py b/searx/search/processors/online_url_search.py index 2863be28e..6383fa37f 100644 --- a/searx/search/processors/online_url_search.py +++ b/searx/search/processors/online_url_search.py @@ -20,6 +20,9 @@ class OnlineUrlSearchProcessor(OnlineProcessor): engine_type = 'online_url_search' def get_params(self, search_query, engine_category): + """Returns a set of *request params* or ``None`` if search query does not match + to at least one of :py:obj:`re_search_urls`. + """ params = super().get_params(search_query, engine_category) if params is None: return None