From b3c38952940258b83c52897b5fc4471659b788c4 Mon Sep 17 00:00:00 2001 From: Crizomb <62544756+Crizomb@users.noreply.github.com> Date: Tue, 22 Sep 2026 09:13:02 +0200 Subject: [PATCH] =?UTF-8?q?[docs]=20indicate=20modification=20of=20setting?= =?UTF-8?q?s.yml=20is=20necessary=20to=20add=20new=20=E2=80=A6=20(#6685)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [docs] indicate modification of settings.yml is necessary to add new plugin + small exemple code correction * [docs] plugins: add more details about adding new plugins --- searx/plugins/__init__.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index ed39c2459..fced4b47b 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -27,10 +27,12 @@ Add Answer example Here is an example of a very simple plugin that adds a "Hello World" into the answer area: +In ``searx/plugins`` create a file named ``hello_world.py`` with the following content: + .. code:: python from flask_babel import gettext as _ - from searx.plugins import Plugin + from searx.plugins import Plugin, PluginInfo from searx.result_types import Answer class MyPlugin(Plugin): @@ -44,6 +46,23 @@ answer area: def post_search(self, request, search): return [ Answer(answer="Hello World") ] +You will then need to add your new plugin in the :ref:`settings.yml` file like this: + +.. code:: yaml + + plugins: + ... + searx.plugins.hello_world.MyPlugin: + active: true + + +``searx.plugins.hello_world.MyPlugin`` is the Python import path of the new plugin we created. +``searx.plugins.hello_world`` represents the file path, while ``MyPlugin`` represents the name of the plugin class. + +If you don't want the plugin to be part of SearXNG's core (i.e. maintain it independently of SearXNG), +you may also place the file at any other path as long as you update the reference to it in :ref:`settings.yml`. +For more examples, see :ref:`settings external_plugins`. + .. _filter urls example: Filter URLs example