summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvojkovic <git@vojk.au>2026-08-01 10:17:29 +0000
committerBrock Vojkovic <brock@vojk.au>2026-08-05 00:00:54 +0800
commit1689cb1b5354e449133dd006a6a841499676289c (patch)
treee51d524fe0bc0032c17010629a0aa57488a09560
parentaa059419ff027cb23be88ffa3b080a41e386fa95 (diff)
[feat] autocomplete: add kagi autocompleter
-rw-r--r--docs/admin/settings/settings_search.rst1
-rw-r--r--searx/autocomplete.py19
-rw-r--r--searx/settings.yml4
3 files changed, 22 insertions, 2 deletions
diff --git a/docs/admin/settings/settings_search.rst b/docs/admin/settings/settings_search.rst
index 8bb4c8676..2aaa4795d 100644
--- a/docs/admin/settings/settings_search.rst
+++ b/docs/admin/settings/settings_search.rst
@@ -41,6 +41,7 @@
- ``dbpedia``
- ``duckduckgo``
- ``google``
+ - ``kagi``
- ``mwmbl``
- ``naver``
- ``privacywall``
diff --git a/searx/autocomplete.py b/searx/autocomplete.py
index 2063aec7b..dfb1f110e 100644
--- a/searx/autocomplete.py
+++ b/searx/autocomplete.py
@@ -157,6 +157,24 @@ def google_complete(query: str, sxng_locale: str) -> list[str]:
return results
+def kagi(query: str, sxng_locale: str) -> list[str]:
+ """Autocomplete from Kagi."""
+
+ args: dict[str, str] = {'q': query}
+
+ if '-' in sxng_locale:
+ args['r'] = sxng_locale.split('-')[1].lower()
+
+ resp = get("https://kagisuggest.com/api/autosuggest?" + urlencode(args))
+ results: list[str] = []
+
+ if resp.ok:
+ data = resp.json()
+ if len(data) > 1:
+ results = data[1]
+ return results
+
+
def mwmbl(query: str, _sxng_locale: str) -> list[str]:
"""Autocomplete from Mwmbl_."""
@@ -380,6 +398,7 @@ backends: dict[str, t.Callable[[str, str], list[str]]] = {
'dbpedia': dbpedia,
'duckduckgo': duckduckgo,
'google': google_complete,
+ 'kagi': kagi,
'mwmbl': mwmbl,
'naver': naver,
'privacywall': privacywall,
diff --git a/searx/settings.yml b/searx/settings.yml
index ad605f256..e8c540d12 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -41,8 +41,8 @@ search:
# Filter results. 0: None, 1: Moderate, 2: Strict
safe_search: 0
# Existing autocomplete backends: "360search", "baidu", "bing", "brave", "dbpedia", "duckduckgo", "google",
- # "yandex", "privacywall", "mwmbl", "naver", "seznam", "sogou", "startpage", "swisscows", "quark", "qwant",
- # "wikipedia" - leave blank to turn it off by default.
+ # "kagi", "yandex", "privacywall", "mwmbl", "naver", "seznam", "sogou", "startpage", "swisscows", "quark",
+ # "qwant", "wikipedia" - leave blank to turn it off by default.
autocomplete: ""
# minimun characters to type before autocompleter starts
autocomplete_min: 4