web-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSearXNG Search Skill
SearXNG 搜索技能
Prerequisites: Runto auto-install and start SearXNG (Docker-based, idempotent — safe to re-run).bash skills/searxng/scripts/setup.sh
前置条件: 运行来自动安装并启动SearXNG(基于Docker,幂等——可安全重复运行)。bash skills/searxng/scripts/setup.sh
Searching
搜索方法
Query the local SearXNG instance via (preferred — WebFetch blocks localhost):
curlbash
curl -s "http://localhost:8888/search?q=YOUR+QUERY&format=json"Common variations:
bash
undefined通过 查询本地SearXNG实例(优先选择此方式——WebFetch会拦截localhost请求):
curlbash
curl -s "http://localhost:8888/search?q=YOUR+QUERY&format=json"常见使用变体:
bash
undefinedTarget specific engines (reduces noise)
指定搜索源(减少无关结果)
Filter by recency
按发布时间筛选
Chinese content
搜索中文内容
Dev/code questions
开发/代码相关问题搜索
**Parse results with python (recommended):**
```bash
curl -s "http://localhost:8888/search?q=YOUR+QUERY&format=json" | \
python3 -c "import sys,json; data=json.load(sys.stdin); [print(f'- {r[\"title\"]}\n {r[\"url\"]}\n {r[\"content\"][:150]}') for r in data.get('results',[])[:5]]"
**推荐使用Python解析结果:**
```bash
curl -s "http://localhost:8888/search?q=YOUR+QUERY&format=json" | \
python3 -c "import sys,json; data=json.load(sys.stdin); [print(f'- {r[\"title\"]}\n {r[\"url\"]}\n {r[\"content\"][:150]}') for r in data.get('results',[])[:5]]"Parameters
参数说明
| Parameter | Description | Values |
|---|---|---|
| Search query | URL-encoded string |
| Specific engines | |
| Language | |
| Page number | |
| Recency filter | |
| Safe search | |
| 参数名 | 描述 | 可取值 |
|---|---|---|
| 搜索关键词 | URL编码后的字符串 |
| 指定搜索源 | |
| 搜索语言 | |
| 页码 | |
| 时间范围筛选 | |
| 安全搜索级别 | |
Best Practices
最佳实践
Read snippets before fetching pages. Each result has a field with a relevant excerpt — this often contains the answer directly. Fetching full pages costs significantly more tokens, so only do it when the snippet isn't enough.
contentLimit to top 3–5 results. The first few results are almost always sufficient. More results mean more tokens without meaningfully better answers.
Target engines for the task. Narrowing to relevant engines reduces noise and speeds up results:
- Code / dev:
engines=stackoverflow,github - Chinese content:
engines=baidu,bing&lang=zh - Recent events: append
&time_range=week
抓取页面内容前先阅读结果摘要。 每个搜索结果都有字段,包含相关的内容摘要——通常直接就能在摘要里找到答案。抓取完整页面会消耗大量token,所以仅当摘要不足以提供答案时再执行页面抓取。
content仅保留前3-5条结果。 前几条结果几乎总能满足需求,更多结果只会消耗更多token,并不会显著提升答案质量。
根据任务指定搜索源。 缩小搜索源范围可以减少无关结果,提升搜索速度:
- 代码/开发相关:
engines=stackoverflow,github - 中文内容:
engines=baidu,bing&lang=zh - 近期事件:追加
&time_range=week
If SearXNG is not running
如果SearXNG未运行
Run the setup script first, then retry:
bash
bash skills/web-search/scripts/setup.sh先运行安装脚本,然后重试:
bash
bash skills/web-search/scripts/setup.shNote on WebFetch
WebFetch使用说明
Do NOT use for SearXNG — it blocks all local/private addresses (localhost, 127.0.0.1, 192.168.x.x, [::1], custom hosts entries) due to SSRF protection. Always use via Bash.
WebFetchcurl不要对SearXNG使用——出于SSRF防护机制,它会拦截所有本地/私有地址(localhost、127.0.0.1、192.168.x.x、[::1]、自定义hosts条目)。请始终通过Bash使用请求。
WebFetchcurlNotes
注意事项
- First request may be slow (engine warm-up)
- For remote or production use, add authentication to your SearXNG instance
- 首次请求可能较慢(搜索引擎预热)
- 如果是远程部署或生产环境使用,请为你的SearXNG实例添加身份认证