web-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SearXNG Search Skill

SearXNG 搜索技能

Prerequisites: Run
bash skills/searxng/scripts/setup.sh
to auto-install and start SearXNG (Docker-based, idempotent — safe to re-run).
前置条件: 运行
bash skills/searxng/scripts/setup.sh
来自动安装并启动SearXNG(基于Docker,幂等——可安全重复运行)。

Searching

搜索方法

Query the local SearXNG instance via
curl
(preferred — WebFetch blocks localhost):
bash
curl -s "http://localhost:8888/search?q=YOUR+QUERY&format=json"
Common variations:
bash
undefined
通过
curl
查询本地SearXNG实例(优先选择此方式——WebFetch会拦截localhost请求):
bash
curl -s "http://localhost:8888/search?q=YOUR+QUERY&format=json"
常见使用变体:
bash
undefined

Target 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

参数说明

ParameterDescriptionValues
q
Search queryURL-encoded string
engines
Specific engines
google,bing,duckduckgo,stackoverflow,github,baidu,...
lang
Language
zh
,
en
,
all
pageno
Page number
1
,
2
, ...
time_range
Recency filter
day
,
week
,
month
,
year
safesearch
Safe search
0
,
1
,
2
参数名描述可取值
q
搜索关键词URL编码后的字符串
engines
指定搜索源
google,bing,duckduckgo,stackoverflow,github,baidu,...
lang
搜索语言
zh
,
en
,
all
pageno
页码
1
,
2
, ...
time_range
时间范围筛选
day
,
week
,
month
,
year
safesearch
安全搜索级别
0
,
1
,
2

Best Practices

最佳实践

Read snippets before fetching pages. Each result has a
content
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.
Limit 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
抓取页面内容前先阅读结果摘要。 每个搜索结果都有
content
字段,包含相关的内容摘要——通常直接就能在摘要里找到答案。抓取完整页面会消耗大量token,所以仅当摘要不足以提供答案时再执行页面抓取。
仅保留前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.sh

Note on WebFetch

WebFetch使用说明

Do NOT use
WebFetch
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
curl
via Bash.
不要对SearXNG使用
WebFetch
——出于SSRF防护机制,它会拦截所有本地/私有地址(localhost、127.0.0.1、192.168.x.x、[::1]、自定义hosts条目)。请始终通过Bash使用
curl
请求。

Notes

注意事项

  • First request may be slow (engine warm-up)
  • For remote or production use, add authentication to your SearXNG instance
  • 首次请求可能较慢(搜索引擎预热)
  • 如果是远程部署或生产环境使用,请为你的SearXNG实例添加身份认证