.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"]
 
 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 69 of file __init__.py.

69def maintenance(force: bool = True):
70 """Carry out maintenance on cache of the engines."""
71 ENGINES_CACHE.maintenance(force=force)
72
73

◆ state()

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

Definition at line 54 of file __init__.py.

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

Variable Documentation

◆ __all__

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

Definition at line 27 of file __init__.py.

◆ app

searx.enginelib.app = typer.Typer()

Definition at line 50 of file __init__.py.

◆ ENGINES_CACHE

searx.enginelib.ENGINES_CACHE
Initial value:
1= ExpireCache.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 39 of file __init__.py.