Search processors

Back to top

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.

query: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Search term, stripped of search syntax arguments.

category: [str](https://docs.python.org/3/builtins/stdtypes.html#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.

pageno: [int](https://docs.python.org/3/builtins/functions.html#int)
:   Current page number, where the first page is `1`.

safesearch: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)[0, 1, 2]
:   Safe-Search filter (0:normal, 1:moderate, 2:strict).

time\_range: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['day', 'week', 'month', 'year'] | [None](https://docs.python.org/3/builtins/constants.html#None)
:   Time-range filter.

engine\_data: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]
:   Allows the transfer of (engine specific) data to the next request of the
    client. In the case of the `online` engines, 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](https://docs.searxng.org/dev/templates.html#engine-data).

searxng\_locale: [str](https://docs.python.org/3/builtins/stdtypes.html#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`](https://docs.searxng.org/src/searx.locales.html#module-searx.locales).

class searx.search.processors.abstract.SuspendedStatus[source] : Class to handle suspend state.

class searx.search.processors.abstract.EngineProcessor(engine: Engine | types.ModuleType)[source] : Base classes used for all types of request processors.

initialize(*callback: [Callable](https://docs.python.org/3/library/typing.html#typing.Callable)[[[EngineProcessor](#searx.search.processors.abstract.EngineProcessor), [bool](https://docs.python.org/3/builtins/functions.html#bool)], [bool](https://docs.python.org/3/builtins/functions.html#bool)]*)[[source]](https://docs.searxng.org/_modules/searx/search/processors/abstract.html#EngineProcessor.initialize)
:   Initialization of *this* [`EngineProcessor`](#searx.search.processors.abstract.EngineProcessor).

    If processor’s engine has an `init` method, it is called first.
    Engine’s `init` method is executed in a thread, meaning that the
    *registration* (the `callback`) may occur later and is not already
    established by the return from this registration method.

    Registration only takes place if the `init` method is not available or
    is successfully run through.

get\_params(*search\_query: [SearchQuery](https://docs.searxng.org/src/searx.search.html#searx.search.models.SearchQuery)*, *engine\_category: [str](https://docs.python.org/3/builtins/stdtypes.html#str)*) → [RequestParams](#searx.search.processors.abstract.RequestParams) | [None](https://docs.python.org/3/builtins/constants.html#None)[[source]](https://docs.searxng.org/_modules/searx/search/processors/abstract.html#EngineProcessor.get_params)
:   Returns a dictionary with the [request parameters](https://docs.searxng.org/dev/engines/engine_overview.html#engine-request-arguments) ([`RequestParams`](#searx.search.processors.abstract.RequestParams)), if the search condition
    is not supported by the engine, `None` is 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 offline engines.

Online processor

Processor used for online engines.

class searx.search.processors.online.OnlineProcessor(engine: Engine | types.ModuleType)[source] : Processor class for online engines.

init\_engine() → [bool](https://docs.python.org/3/builtins/functions.html#bool)[[source]](https://docs.searxng.org/_modules/searx/search/processors/online.html#OnlineProcessor.init_engine)
:   This method is called in a thread, and before the base method is
    called, the network must be set up for the `online` engines.

get\_params(*search\_query: [SearchQuery](https://docs.searxng.org/src/searx.search.html#searx.search.models.SearchQuery)*, *engine\_category: [str](https://docs.python.org/3/builtins/stdtypes.html#str)*) → [OnlineParams](#searx.search.processors.online.OnlineParams) | [None](https://docs.python.org/3/builtins/constants.html#None)[[source]](https://docs.searxng.org/_modules/searx/search/processors/online.html#OnlineProcessor.get_params)
:   Returns a dictionary with the [request params](https://docs.searxng.org/dev/engines/engine_overview.html#engine-request-online) ([`OnlineParams`](#searx.search.processors.online.OnlineParams)), if the search condition is not
    supported by the engine, `None` is returned.

class searx.search.processors.online.OnlineParams[source] : Request parameters of a online engine.

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.

amount: [float](https://docs.python.org/3/builtins/functions.html#float)
:   Currency amount to be converted

to\_iso4217: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   [ISO\_4217](https://en.wikipedia.org/wiki/ISO_4217) alpha code of the currency used as the basis for conversion.

from\_iso4217: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   [ISO\_4217](https://en.wikipedia.org/wiki/ISO_4217) alpha code of the currency to be converted.

from\_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Name of the currency used as the basis for conversion.

to\_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Name of the currency of the currency to be converted.

class searx.search.processors.online_currency.OnlineCurrenciesParams[source] : Request parameters of a online_currency engine.

class searx.search.processors.online_currency.OnlineCurrencyProcessor(engine: Engine | types.ModuleType)[source] : Processor class used by online_currency engines.

get\_params(*search\_query: [SearchQuery](https://docs.searxng.org/src/searx.search.html#searx.search.models.SearchQuery)*, *engine\_category: [str](https://docs.python.org/3/builtins/stdtypes.html#str)*) → [OnlineCurrenciesParams](#searx.search.processors.online_currency.OnlineCurrenciesParams) | [None](https://docs.python.org/3/builtins/constants.html#None)[[source]](https://docs.searxng.org/_modules/searx/search/processors/online_currency.html#OnlineCurrencyProcessor.get_params)
:   Returns a dictionary with the [request params](https://docs.searxng.org/dev/engines/engine_overview.html#engine-request-online-currency) ([`OnlineCurrenciesParams`](#searx.search.processors.online_currency.OnlineCurrenciesParams)). `None` is
    returned if the search query does not match [`search_syntax`](#searx.search.processors.online_currency.search_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.

alias of [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[`bool`](https://docs.python.org/3/builtins/functions.html#bool), [`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)]

class searx.search.processors.online_dictionary.DictParams[source] : Dictionary request parameters.

from\_lang: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[bool](https://docs.python.org/3/builtins/functions.html#bool), [str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]
:   Language from which is to be translated.

to\_lang: [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[bool](https://docs.python.org/3/builtins/functions.html#bool), [str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]
:   Language to translate into.

query: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Search term, cleaned of search syntax (*from-to* has been removed).

class searx.search.processors.online_dictionary.OnlineDictParams[source] : Request parameters of a online_dictionary engine.

class searx.search.processors.online_dictionary.OnlineDictionaryProcessor(engine: Engine | types.ModuleType)[source] : Processor class for online_dictionary engines.

get\_params(*search\_query: [SearchQuery](https://docs.searxng.org/src/searx.search.html#searx.search.models.SearchQuery)*, *engine\_category: [str](https://docs.python.org/3/builtins/stdtypes.html#str)*) → [OnlineDictParams](#searx.search.processors.online_dictionary.OnlineDictParams) | [None](https://docs.python.org/3/builtins/constants.html#None)[[source]](https://docs.searxng.org/_modules/searx/search/processors/online_dictionary.html#OnlineDictionaryProcessor.get_params)
:   Returns a dictionary with the [request params](https://docs.searxng.org/dev/engines/engine_overview.html#engine-request-online-dictionary) ([`OnlineDictParams`](#searx.search.processors.online_dictionary.OnlineDictParams)). `None` is returned
    if the search query does not match [`search_syntax`](#searx.search.processors.online_dictionary.search_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.UrlParams[source] : URL request parameters.

class searx.search.processors.online_url_search.OnlineUrlSearchParams[source] : Request parameters of a online_url_search engine.

class searx.search.processors.online_url_search.OnlineUrlSearchProcessor(engine: Engine | types.ModuleType)[source] : Processor class used by online_url_search engines.

get\_params(*search\_query: [SearchQuery](https://docs.searxng.org/src/searx.search.html#searx.search.models.SearchQuery)*, *engine\_category: [str](https://docs.python.org/3/builtins/stdtypes.html#str)*) → [OnlineUrlSearchParams](#searx.search.processors.online_url_search.OnlineUrlSearchParams) | [None](https://docs.python.org/3/builtins/constants.html#None)[[source]](https://docs.searxng.org/_modules/searx/search/processors/online_url_search.html#OnlineUrlSearchProcessor.get_params)
:   Returns a dictionary with the [request params](https://docs.searxng.org/dev/engines/engine_overview.html#engine-request-online-currency) ([`OnlineUrlSearchParams`](#searx.search.processors.online_url_search.OnlineUrlSearchParams)). `None` is
    returned if the search query does not match [`search_syntax`](#searx.search.processors.online_url_search.search_syntax).

Copyright © SearXNG team

Made with Furo

💾 🌐