feat: add support for searxng (#1814)

* Add support for searxng

* body.results not body.web

* type annotation

* update docs
This commit is contained in:
Jorge Valdez
2025-04-09 02:35:42 -04:00
committed by GitHub
parent d5210f4afb
commit 1fc57ab1ae
4 changed files with 51 additions and 6 deletions

View File

@@ -186,6 +186,28 @@ M._defaults = {
end
)
return vim.json.encode(jsn), nil
end,
},
searxng = {
api_url_name = "SEARXNG_API_URL",
extra_request_body = {
format = "json",
},
---@type WebSearchEngineProviderResponseBodyFormatter
format_response_body = function(body)
if body.results == nil then return "", nil end
local jsn = vim.iter(body.results):map(
function(result)
return {
title = result.title,
url = result.url,
snippet = result.content,
}
end
)
return vim.json.encode(jsn), nil
end,
},