From 5b815b3966f2fc094ef937431d14062bd9398710 Mon Sep 17 00:00:00 2001
From: Allen <64094914+allendema@users.noreply.github.com>
Date: Tue, 7 Jun 2022 22:48:14 +0200
Subject: [PATCH] [enh] initial Marginalia.nu support (foss)

Currently it uses a public api_key `/public/` [1]

The 'index' parameter selects the search index, corresponding to the drop down
next to the search field in the main GUI.

    0: popular
    1: blogs
    2: big_sites
    3: default
    4: experimental

'experimental' is more up to date and does not exclude other sites, which is the
case with 'big sites' or 'blogs'.

[1] https://api.marginalia.nu/
[2] https://git.marginalia.nu/marginalia/marginalia.nu
[3] https://news.ycombinator.com/item?id=31536626

Closes: https://github.com/searxng/searxng/issues/1620
---
 searx/settings.yml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/searx/settings.yml b/searx/settings.yml
index 8a97bbcdc..e11a3ea75 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -1377,6 +1377,27 @@ engines:
     about:
       website: https://wiby.me/
 
+  - name: marginalia
+    engine: json_engine
+    shortcut: mar
+    categories: general
+    paging: false
+    # index: {"0": "popular", "1": "blogs", "2": "big_sites",
+    # "3": "default", "4": experimental"}
+    search_url: https://api.marginalia.nu/public/search/{query}?index=4&count=20
+    results_query: results
+    url_query: url
+    title_query: title
+    content_query: description
+    timeout: 1.5
+    disabled: true
+    about:
+      website: https://www.marginalia.nu/
+      official_api_documentation: https://api.marginalia.nu/
+      use_official_api: true
+      require_api_key: true
+      results: JSON
+
   - name: alexandria
     engine: json_engine
     shortcut: alx