summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2024-06-18 11:10:41 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-06-18 12:06:06 +0200
commitacf3f109b2a99a5e6f25f5f2975016a36673c6ef (patch)
tree4c514fc6d64af605b117809b3686ab20b9eb3d66
parentaccc1c10322d9ee34b4aafe6e7a5dfbc785b5624 (diff)
downloadsearxng-acf3f109b2a99a5e6f25f5f2975016a36673c6ef.tar.gz
searxng-acf3f109b2a99a5e6f25f5f2975016a36673c6ef.zip
[doc] hostname plugin: improve online documentation
The data types (list & map) should be made clearer, as these sometimes lead to misunderstandings. [1] https://github.com/searxng/searxng/issues/3558#issuecomment-2175058128 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r--searx/plugins/hostnames.py51
1 files changed, 42 insertions, 9 deletions
diff --git a/searx/plugins/hostnames.py b/searx/plugins/hostnames.py
index 3c699c4fd..2fdf1669d 100644
--- a/searx/plugins/hostnames.py
+++ b/searx/plugins/hostnames.py
@@ -13,21 +13,54 @@ other features.
**To maintainers of SearXNG instances, please modify your old plugin config
to the new.**
-- ``hostnames.replace``: A mapping of regular expressions to hostnames to be
+- ``hostnames.replace``: A **mapping** of regular expressions to hostnames to be
replaced by other hostnames.
-- ``hostnames.remove``: A list of regular expressions of the hostnames whose
+ .. code:: yaml
+
+ hostnames:
+ replace:
+ '(.*\\.)?youtube\\.com$': 'invidious.example.com'
+ '(.*\\.)?youtu\\.be$': 'invidious.example.com'
+ ...
+
+- ``hostnames.remove``: A **list** of regular expressions of the hostnames whose
results should be taken from the results list.
-- ``hostnames.high_priority``: A list of regular expressions for hostnames whose
- result should be given higher priority. The results from these hosts are
+ .. code:: yaml
+
+ hostnames:
+ remove:
+ - '(.*\\.)?facebook.com$'
+ - ...
+
+- ``hostnames.high_priority``: A **list** of regular expressions for hostnames
+ whose result should be given higher priority. The results from these hosts are
arranged higher in the results list.
-- ``hostnames.lower_priority``: A list of regular expressions for hostnames
+ .. code:: yaml
+
+ hostnames:
+ high_priority:
+ - '(.*\\.)?wikipedia.org$'
+ - ...
+
+- ``hostnames.lower_priority``: A **list** of regular expressions for hostnames
whose result should be given lower priority. The results from these hosts are
arranged lower in the results list.
-Alternatively, a file name can also be specified for the mappings or lists:
+ .. code:: yaml
+
+ hostnames:
+ low_priority:
+ - '(.*\\.)?google(\\..*)?$'
+ - ...
+
+If the URL matches the pattern of ``high_priority`` AND ``low_priority``, the
+higher priority wins over the lower priority.
+
+Alternatively, you can also specify a file name for the **mappings** or
+**lists** to load these from an external file:
.. code:: yaml
@@ -35,13 +68,13 @@ Alternatively, a file name can also be specified for the mappings or lists:
replace: 'rewrite-hosts.yml'
remove:
- '(.*\\.)?facebook.com$'
- ...
+ - ...
low_priority:
- '(.*\\.)?google(\\..*)?$'
- ...
+ - ...
high_priority:
- '(.*\\.)?wikipedia.org$'
- ...
+ - ...
The ``rewrite-hosts.yml`` from the example above must be in the folder in which
the ``settings.yml`` file is already located (``/etc/searxng``). The file then