简介
自托管元搜索引擎,聚合70+引擎结果,零追踪零广告,JSON API支持自动化
原始描述
Search the web using a self-hosted SearXNG instance. Privacy-respecting metasearch that aggregates results from multiple engines.
中文使用说明 来自收录源
核心用法
本 Skill 是一份完整的 SearXNG 自托管指南,帮助用户在本地或服务器上部署私有元搜索引擎。SearXNG 是一个开源的隐私保护搜索引擎,能够同时查询 Google、DuckDuckGo、Brave、Startpage 等70多个搜索引擎,并聚合返回结果。
Skill 提供了详尽的部署流程:从 Docker Compose 配置文件编写、settings.yml 参数配置,到容器启动、日志排查的全生命周期管理。用户可通过环境变量 SEARXNG_URL 自定义实例地址,支持多种搜索类别(网页、图片、新闻、视频、IT文档、学术论文)和语言区域过滤,以及分页查询功能。
此外,Skill 还附赠了一个实用的 Shell 函数模板,用户可将其添加到 .zshrc 或 .bashrc 中,实现命令行快捷搜索,如 searxng "量子计算最新进展" 即可直接在终端获取结构化结果。
显著优点
极致隐私保护:SearXNG 不追踪用户、不显示广告、不收集数据,所有搜索行为保留在自托管实例上,从根本上杜绝了商业搜索引擎的数据画像问题。
结果全面聚合:单一查询即可覆盖70+搜索引擎,自动去重并综合排序,避免单一引擎的算法偏见或结果盲区,特别适合研究性查询和对比分析。
零成本零限制:无需 API Key,无调用次数限制,无商业授权约束,个人和小团队可无限量使用。
完全自主可控:开源代码 + 自托管部署,用户掌握全部数据主权,可根据需求定制引擎权重、过滤规则、界面主题等。
JSON API 原生支持:直接输出结构化数据,便于与自动化脚本、数据分析工具、AI Agent 工作流集成。
潜在缺点与局限性
运维门槛:需要用户具备基础的 Docker/Linux 运维知识,包括容器管理、端口配置、日志排查等,纯技术小白上手有难度。
硬件与网络成本:需自备服务器资源(本地或云端),持续运行会产生电力或云主机费用;公网访问还需配置域名、HTTPS 证书、防火墙规则等。
引擎可用性波动:底层搜索引擎(如 Google)可能对 SearXNG 实例实施反爬策略或速率限制,导致某些类别结果不稳定,需要定期维护引擎配置。
无云端即开即用:与商业搜索 API 不同,本 Skill 不提供托管服务,用户必须自行完成全部部署流程,无法"开箱即用"。
功能边界:仅为部署文档,不包含实际搜索执行代码,Agent 调用时需确保用户已预先完成 SearXNG 实例搭建。
适合的目标群体
隐私敏感型用户:对 Google/Bing 数据收集有顾虑,希望将搜索行为完全本地化的个人或组织。
开发者与技术运维:需要为内部系统、自动化脚本、CI/CD 流程提供稳定搜索能力的工程师团队。
科研人员与情报分析师:需要跨引擎对比搜索结果、规避单一平台算法过滤、获取更全面信息的研究者。
自托管爱好者:热衷于搭建私有云服务的 Homelab 玩家,希望将搜索基础设施纳入现有 Docker/Kubernetes 生态。
AI Agent 构建者:需要可靠、无配额限制的搜索后端,为 LLM 应用提供实时信息检索能力。
使用风险
部署风险:Docker 配置不当可能导致容器无法启动、端口冲突或安全组暴露,建议首次部署后在防火墙层面限制访问源 IP。
依赖维护:SearXNG 镜像和底层引擎规则持续更新,长期运行需关注上游版本迭代,避免安全漏洞或引擎失效。
数据安全:虽为隐私优先设计,但自托管实例若部署在公网且未配置 HTTPS/认证,可能被未授权扫描利用,建议搭配反向代理和访问控制。
性能瓶颈:单机实例在高并发场景下可能成为瓶颈,大规模使用需考虑多实例负载均衡或缓存策略。
误报说明:Skill 文档中包含向 .bashrc 添加 shell 函数的示例说明,曾被静态扫描工具标记为潜在风险,实际为人工复制粘贴操作,非自动执行,用户可控。
技能正文
name: searxng description: Search the web using a self-hosted SearXNG instance. Privacy-respecting metasearch that aggregates results from multiple engines. metadata: clawdbot: config: optionalEnv: - SEARXNG_URL
SearXNG Search Skill
Search the web using your self-hosted SearXNG instance. Privacy-respecting metasearch that aggregates results from Google, DuckDuckGo, Brave, Startpage, and 70+ other engines.
Prerequisites
SearXNG running locally or on a server. Quick Docker setup:
mkdir -p ~/Projects/searxng/searxng
cd ~/Projects/searxng
# Create docker-compose.yml
cat > docker-compose.yml << 'EOF'
services:
searxng:
image: searxng/searxng:latest
container_name: searxng
ports:
- "8080:8080"
volumes:
- ./searxng:/etc/searxng:rw
environment:
- SEARXNG_BASE_URL=http://localhost:8080/
restart: unless-stopped
EOF
# Create settings.yml with JSON API enabled
cat > searxng/settings.yml << 'EOF'
use_default_settings: true
server:
secret_key: "change-me-to-random-string"
bind_address: "0.0.0.0"
port: 8080
search:
safe_search: 0
autocomplete: "google"
default_lang: "en"
formats:
- html
- json
EOF
# Start SearXNG
docker compose up -d
Configuration
Set the SearXNG URL (defaults to http://localhost:8080):
export SEARXNG_URL="http://localhost:8080"
Usage Examples
Basic Search
curl "http://localhost:8080/search?q=your+query&format=json" | jq '.results[:5]'
Search with Categories
# General web search
curl "http://localhost:8080/search?q=query&categories=general&format=json"
# Images
curl "http://localhost:8080/search?q=query&categories=images&format=json"
# News
curl "http://localhost:8080/search?q=query&categories=news&format=json"
# Videos
curl "http://localhost:8080/search?q=query&categories=videos&format=json"
# IT/Tech documentation
curl "http://localhost:8080/search?q=query&categories=it&format=json"
# Science/Academic
curl "http://localhost:8080/search?q=query&categories=science&format=json"
Search with Language/Region
curl "http://localhost:8080/search?q=query&language=en-US&format=json"
curl "http://localhost:8080/search?q=query&language=de-DE&format=json"
Paginated Results
# Page 2 (results 11-20)
curl "http://localhost:8080/search?q=query&pageno=2&format=json"
Response Format
Each result includes:
title- Result titleurl- Link to the resultcontent- Snippet/descriptionengines- Array of search engines that returned this resultscore- Relevance score (higher = better)category- Result category
Shell Function
Add to your .zshrc or .bashrc:
searxng() {
local query="$*"
local url="${SEARXNG_URL:-http://localhost:8080}"
curl -s "${url}/search?q=$(echo "$query" | sed 's/ /+/g')&format=json" | \
jq -r '.results[:10][] | "[\(.score | floor)] \(.title)\n \(.url)\n \(.content // "No description")\n"'
}
Usage: searxng how to make sourdough bread
Docker Management
# Start
cd ~/Projects/searxng && docker compose up -d
# Stop
docker compose down
# View logs
docker compose logs -f searxng
# Restart
docker compose restart
Troubleshooting
Container won't start:
docker compose logs searxng
JSON format not working:
Ensure formats: [html, json] is in your settings.yml
No results: Some engines may be rate-limited. Check logs for errors.
Why SearXNG?
- Privacy: No tracking, no ads, no data collection
- Aggregation: Combines results from 70+ search engines
- Self-hosted: Your data stays on your machine
- API: JSON output for automation
- Free: No API keys or rate limits
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。