.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.enginelib.Engine Class Reference
Inheritance diagram for searx.enginelib.Engine:
Collaboration diagram for searx.enginelib.Engine:

Public Member Functions

bool setup (self, dict[str, t.Any] engine_settings)
bool|None init (self, dict[str, t.Any] engine_settings)
"EngineResults" search (self, str query, "OfflineParamTypes" params)
None request (self, str query, "OnlineParamTypes" params)
"EngineResults" response (self, "SXNG_Response" resp)

Static Public Attributes

logging logger .Logger
int max_page = 0
str fetch_traits : "Callable[[EngineTraits, bool], None]"
str traits : "traits.EngineTraits"
list categories [str]
dict proxies [str, dict[str, str]]
dict about [str, dict[str, str]]
list tokens [str]

Detailed Description

Class of engine instances build from YAML settings.

Further documentation see :ref:`general engine configuration`.

.. hint::

   This class is currently never initialized and only used for type hinting.

Definition at line 179 of file __init__.py.

Member Function Documentation

◆ init()

bool | None searx.enginelib.Engine.init ( self,
dict[str, t.Any] engine_settings )
Initialization of the engine.

The method is optional and asynchronous (in a thread).  It is suitable,
for example, for setting up a cache (for the engine) or for querying
values (required by the engine) from a remote.

Whether the initialization was successful can be indicated by the return
value ``True`` or even ``False``.

- If no return value is given from this init method (``None``), this is
  equivalent to ``True``.

- If an exception is thrown as part of the initialization, this is
  equivalent to ``False``.

Definition at line 328 of file __init__.py.

328 def init(self, engine_settings: dict[str, t.Any]) -> bool | None: # pylint: disable=unused-argument
329 """Initialization of the engine.
330
331 The method is optional and asynchronous (in a thread). It is suitable,
332 for example, for setting up a cache (for the engine) or for querying
333 values (required by the engine) from a remote.
334
335 Whether the initialization was successful can be indicated by the return
336 value ``True`` or even ``False``.
337
338 - If no return value is given from this init method (``None``), this is
339 equivalent to ``True``.
340
341 - If an exception is thrown as part of the initialization, this is
342 equivalent to ``False``.
343 """
344 return True
345

Referenced by searx.sqlitedb.SQLiteAppl.connect(), and searx.sqlitedb.SQLiteAppl.DB().

Here is the caller graph for this function:

◆ request()

None searx.enginelib.Engine.request ( self,
str query,
"OnlineParamTypes" params )
Method to build the parameters for the request of an ``online``
engine.

Definition at line 351 of file __init__.py.

351 def request(self, query: str, params: "OnlineParamTypes") -> None:
352 """Method to build the parameters for the request of an ``online``
353 engine."""
354

◆ response()

"EngineResults" searx.enginelib.Engine.response ( self,
"SXNG_Response" resp )
Method to parse the response of an ``online`` engine.

Definition at line 356 of file __init__.py.

356 def response(self, resp: "SXNG_Response") -> "EngineResults":
357 """Method to parse the response of an ``online`` engine."""

◆ search()

"EngineResults" searx.enginelib.Engine.search ( self,
str query,
"OfflineParamTypes" params )
Search method of the ``offline`` engines

Definition at line 347 of file __init__.py.

347 def search(self, query: str, params: "OfflineParamTypes") -> "EngineResults":
348 """Search method of the ``offline`` engines"""
349

◆ setup()

bool searx.enginelib.Engine.setup ( self,
dict[str, t.Any] engine_settings )
Dynamic setup of the engine settings.

With this method, the engine's setup is carried out.  For example, to
check or dynamically adapt the values handed over in the parameter
``engine_settings``.  The return value (True/False) indicates whether
the setup was successful and the engine can be built or rejected.

The method is optional and is called synchronously as part of the
initialization of the service and is therefore only suitable for simple
(local) exams/changes at the engine setting.  The :py:obj:`Engine.init`
method must be used for longer tasks in which values of a remote must be
determined, for example.

Definition at line 312 of file __init__.py.

312 def setup(self, engine_settings: dict[str, t.Any]) -> bool: # pylint: disable=unused-argument
313 """Dynamic setup of the engine settings.
314
315 With this method, the engine's setup is carried out. For example, to
316 check or dynamically adapt the values handed over in the parameter
317 ``engine_settings``. The return value (True/False) indicates whether
318 the setup was successful and the engine can be built or rejected.
319
320 The method is optional and is called synchronously as part of the
321 initialization of the service and is therefore only suitable for simple
322 (local) exams/changes at the engine setting. The :py:obj:`Engine.init`
323 method must be used for longer tasks in which values of a remote must be
324 determined, for example.
325 """
326 return True
327

Member Data Documentation

◆ about

dict searx.enginelib.Engine.about [str, dict[str, str]]
static

Definition at line 283 of file __init__.py.

◆ categories

list searx.enginelib.Engine.categories [str]
static

Definition at line 242 of file __init__.py.

◆ fetch_traits

str searx.enginelib.Engine.fetch_traits : "Callable[[EngineTraits, bool], None]"
static

Definition at line 234 of file __init__.py.

◆ logger

◆ max_page

int searx.enginelib.Engine.max_page = 0
static

Definition at line 199 of file __init__.py.

◆ proxies

dict searx.enginelib.Engine.proxies [str, dict[str, str]]
static

◆ tokens

◆ traits

str searx.enginelib.Engine.traits : "traits.EngineTraits"
static

Definition at line 237 of file __init__.py.


The documentation for this class was generated from the following file:
  • /home/andrew/Documents/code/public/searxng/searx/enginelib/__init__.py