.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.enginelib Namespace Reference

Namespaces

namespace  __main__
namespace  traits

Classes

class  Engine
class  EngineCache

Functions

 state ()
 maintenance (bool force=True)

Variables

list __all__ = ["EngineCache", "Engine", "ENGINES_CACHE"]
ExpireCacheSQLite ENGINES_CACHE
 app = typer.Typer()

Detailed Description

Implementations of the framework for the SearXNG engines.

- :py:obj:`searx.enginelib.EngineCache`
- :py:obj:`searx.enginelib.Engine`
- :py:obj:`searx.enginelib.traits`

There is a command line for developer purposes and for deeper analysis.  Here is
an example in which the command line is called in the development environment::

  $ ./manage pyenv.cmd bash --norc --noprofile
  (py3) python -m searx.enginelib --help

.. hint::

   The long term goal is to modularize all implementations of the engine
   framework here in this Python package.  ToDo:

   - move implementations of the :ref:`searx.engines loader` to a new module in
     the :py:obj:`searx.enginelib` namespace.

-----

Function Documentation

◆ maintenance()

searx.enginelib.maintenance ( bool force = True)
Carry out maintenance on cache of the engines.

Definition at line 73 of file __init__.py.

73def maintenance(force: bool = True):
74 """Carry out maintenance on cache of the engines."""
75 ENGINES_CACHE.maintenance(force=force)
76
77

◆ state()

searx.enginelib.state ( )
Show state for the caches of the engines.

Definition at line 58 of file __init__.py.

58def state():
59 """Show state for the caches of the engines."""
60
61 title = "cache tables and key/values"
62 print(title)
63 print("=" * len(title))
64 print(ENGINES_CACHE.state().report())
65 print()
66 title = f"properties of {ENGINES_CACHE.cfg.name}"
67 print(title)
68 print("=" * len(title))
69 print(str(ENGINES_CACHE.properties))
70
71
72@app.command()

Variable Documentation

◆ __all__

list searx.enginelib.__all__ = ["EngineCache", "Engine", "ENGINES_CACHE"]
private

Definition at line 26 of file __init__.py.

◆ app

searx.enginelib.app = typer.Typer()

Definition at line 54 of file __init__.py.

◆ ENGINES_CACHE

ExpireCacheSQLite searx.enginelib.ENGINES_CACHE
Initial value:
1= ExpireCacheSQLite.build_cache(
2 ExpireCacheCfg(
3 name="ENGINES_CACHE",
4 MAXHOLD_TIME=60 * 60 * 24 * 7, # 7 days
5 MAINTENANCE_PERIOD=60 * 60, # 2h
6 )
7)

Definition at line 43 of file __init__.py.