Search processors¶
Abstract processor class¶
Abstract base classes for all engine processors.
- class searx.search.processors.abstract.RequestParams[source]¶
Basic quantity of the Request parameters of all engine types.
- category: str¶
Current category, like
general.Hint
This field is deprecated, don’t use it in further implementations.
This field is currently arbitrarily filled with the name of “one”” category (the name of the first category of the engine). In practice, however, it is not clear what this “one” category should be; in principle, multiple categories can also be activated in a search.
- engine_data: dict[str, str]¶
Allows the transfer of (engine specific) data to the next request of the client. In the case of the
onlineengines, this data is delivered to the client via the HTML<form>in response.If the client then sends this form back to the server with the next request, this data will be available.
This makes it possible to carry data from one request to the next without a session context, but this feature (is fragile) and should only be used in exceptional cases. See also engine_data_form.
- searxng_locale: str¶
Language / locale filter from the search request, a string like ‘all’, ‘en’, ‘en-US’, ‘zh-HK’ .. and others, for more details see
searx.locales.
- class searx.search.processors.abstract.EngineProcessor(engine: Engine | types.ModuleType)[source]¶
Base classes used for all types of request processors.
- initialize(callback: Callable[[EngineProcessor, bool], bool])[source]¶
Initialization of this
EngineProcessor.If processor’s engine has an
initmethod, it is called first. Engine’sinitmethod is executed in a thread, meaning that the registration (thecallback) may occur later and is not already established by the return from this registration method.Registration only takes place if the
initmethod is not available or is successfully run through.
- get_params(search_query: SearchQuery, engine_category: str) RequestParams | None[source]¶
Returns a dictionary with the request parameters (
RequestParams), if the search condition is not supported by the engine,Noneis returned:- time range filter in search conditions, but the engine does not have
a corresponding filter
page number > 1 when engine does not support paging
page number >
max_page
Offline processor¶
Processors for engine-type: offline
- class searx.search.processors.offline.OfflineProcessor(engine: Engine | types.ModuleType)[source]¶
Processor class used by
offlineengines.
Online processor¶
Processor used for online engines.
- class searx.search.processors.online.OnlineProcessor(engine: Engine | types.ModuleType)[source]¶
Processor class for
onlineengines.- init_engine() bool[source]¶
This method is called in a thread, and before the base method is called, the network must be set up for the
onlineengines.
- get_params(search_query: SearchQuery, engine_category: str) OnlineParams | None[source]¶
Returns a dictionary with the request params (
OnlineParams), if the search condition is not supported by the engine,Noneis returned.
Online currency processor¶
Processor used for online_currency engines.
- searx.search.processors.online_currency.search_syntax = re.compile('.*?(\\d+(?:\\.\\d+)?) ([^.0-9]+) (?:in|to) ([^.0-9]+)', re.IGNORECASE)¶
Search syntax used for from/to currency (e.g.
10 usd to eur)
- class searx.search.processors.online_currency.CurrenciesParams[source]¶
Currencies request parameters.
- class searx.search.processors.online_currency.OnlineCurrenciesParams[source]¶
Request parameters of a
online_currencyengine.
- class searx.search.processors.online_currency.OnlineCurrencyProcessor(engine: Engine | types.ModuleType)[source]¶
Processor class used by
online_currencyengines.- get_params(search_query: SearchQuery, engine_category: str) OnlineCurrenciesParams | None[source]¶
Returns a dictionary with the request params (
OnlineCurrenciesParams).Noneis returned if the search query does not matchsearch_syntax.
Online dictionary processor¶
Processor used for online_dictionary engines.
- searx.search.processors.online_dictionary.search_syntax = re.compile('.*?([a-z]+)-([a-z]+) (.+)$', re.IGNORECASE)¶
Search syntax used for from/to language (e.g.
en-de)
- searx.search.processors.online_dictionary.FromToType¶
Type of a language descriptions in the context of a
online_dictionary.
- class searx.search.processors.online_dictionary.OnlineDictParams[source]¶
Request parameters of a
online_dictionaryengine.
- class searx.search.processors.online_dictionary.OnlineDictionaryProcessor(engine: Engine | types.ModuleType)[source]¶
Processor class for
online_dictionaryengines.- get_params(search_query: SearchQuery, engine_category: str) OnlineDictParams | None[source]¶
Returns a dictionary with the request params (
OnlineDictParams).Noneis returned if the search query does not matchsearch_syntax.
Online URL search processor¶
Processor used for online_url_search engines.
- searx.search.processors.online_url_search.search_syntax = {'data:image': re.compile('data:image/[^; ]*;base64,[^ ]*'), 'ftp': re.compile('ftps?:\\/\\/[^ ]*'), 'http': re.compile('https?:\\/\\/[^ ]*')}¶
Search syntax used for a URL search.
- class searx.search.processors.online_url_search.OnlineUrlSearchParams[source]¶
Request parameters of a
online_url_searchengine.
- class searx.search.processors.online_url_search.OnlineUrlSearchProcessor(engine: Engine | types.ModuleType)[source]¶
Processor class used by
online_url_searchengines.- get_params(search_query: SearchQuery, engine_category: str) OnlineUrlSearchParams | None[source]¶
Returns a dictionary with the request params (
OnlineUrlSearchParams).Noneis returned if the search query does not matchsearch_syntax.