|
.oO SearXNG Developer Documentation Oo.
|
Inheritance diagram for searx.plugins._core.ModulePlugin:
Collaboration diagram for searx.plugins._core.ModulePlugin:Public Member Functions | |
| __init__ (self, types.ModuleType mod, str fqn) | |
| bool | init (self, flask.Flask app) |
| bool | pre_search (self, SXNG_Request request, "SearchWithPlugins" search) |
| bool | on_result (self, SXNG_Request request, "SearchWithPlugins" search, Result result) |
| None|list[Result] | post_search (self, SXNG_Request request, "SearchWithPlugins" search) |
Public Member Functions inherited from searx.plugins._core.Plugin | |
| None | __init__ (self) |
| int | __hash__ (self) |
| __eq__ (self, other) | |
Public Attributes | |
| module = mod | |
| info | |
Static Protected Attributes | |
| tuple | _required_attrs = (("name", str), ("description", str), ("default_on", bool)) |
Additional Inherited Members | |
Static Public Attributes inherited from searx.plugins._core.Plugin | |
| str | id = "" |
| bool | default_on = False |
| list | keywords = [] |
| logging | log .Logger |
| str | fqn = "" |
A wrapper class for legacy *plugins*. .. note:: For internal use only! In a module plugin, the follwing names are mapped: - `module.query_keywords` --> :py:obj:`Plugin.keywords` - `module.plugin_id` --> :py:obj:`Plugin.id` - `module.logger` --> :py:obj:`Plugin.log`
| searx.plugins._core.ModulePlugin.__init__ | ( | self, | |
| types.ModuleType | mod, | ||
| str | fqn ) |
In case of missing attributes in the module or wrong types are given, a :py:obj:`TypeError` exception is raised.
Definition at line 185 of file _core.py.
| bool searx.plugins._core.ModulePlugin.init | ( | self, | |
| flask.Flask | app ) |
Initialization of the plugin, the return value decides whether this plugin is active or not. Initialization only takes place once, at the time the WEB application is set up. The base methode always returns ``True``, the methode can be overwritten in the inheritances, - ``True`` plugin is active - ``False`` plugin is inactive
Reimplemented from searx.plugins._core.Plugin.
Definition at line 220 of file _core.py.
References init(), searx.answerers._core.ModuleAnswerer.module, and module.
Referenced by searx.sqlitedb.SQLiteAppl.connect(), and init().
Here is the call graph for this function:
Here is the caller graph for this function:| bool searx.plugins._core.ModulePlugin.on_result | ( | self, | |
| SXNG_Request | request, | ||
| "SearchWithPlugins" | search, | ||
| Result | result ) |
Runs for each result of each engine and returns a boolean:
- ``True`` to keep the result
- ``False`` to remove the result from the result list
The ``result`` can be modified to the needs.
.. hint::
If :py:obj:`Result.url` is modified, :py:obj:`Result.parsed_url` must
be changed accordingly:
.. code:: python
result["parsed_url"] = urlparse(result["url"])
Reimplemented from searx.plugins._core.Plugin.
Definition at line 230 of file _core.py.
References searx.answerers._core.ModuleAnswerer.module, module, and on_result().
Referenced by on_result().
Here is the call graph for this function:
Here is the caller graph for this function:| None | list[Result] searx.plugins._core.ModulePlugin.post_search | ( | self, | |
| SXNG_Request | request, | ||
| "SearchWithPlugins" | search ) |
Runs AFTER the search request. Can return a list of :py:obj:`Result` objects to be added to the final result list.
Reimplemented from searx.plugins._core.Plugin.
Definition at line 235 of file _core.py.
References searx.answerers._core.ModuleAnswerer.module, module, and post_search().
Referenced by post_search().
Here is the call graph for this function:
Here is the caller graph for this function:| bool searx.plugins._core.ModulePlugin.pre_search | ( | self, | |
| SXNG_Request | request, | ||
| "SearchWithPlugins" | search ) |
Runs BEFORE the search request and returns a boolean: - ``True`` to continue the search - ``False`` to stop the search
Reimplemented from searx.plugins._core.Plugin.
Definition at line 225 of file _core.py.
References searx.answerers._core.ModuleAnswerer.module, module, and pre_search().
Referenced by pre_search().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprotected |
| searx.plugins._core.ModulePlugin.info |
| searx.plugins._core.ModulePlugin.module = mod |
Definition at line 190 of file _core.py.
Referenced by init(), on_result(), post_search(), and pre_search().