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:
CODEBLOCK0
Configuration
Set the SearXNG URL (defaults to http://localhost:8080):
CODEBLOCK1
Usage Examples
Basic Search
CODEBLOCK2
Search with Categories
CODEBLOCK3
Search with Language/Region
CODEBLOCK4
Paginated Results
CODEBLOCK5
Response Format
Each result includes:
- -
title - Result title - INLINECODE1 - Link to the result
- INLINECODE2 - Snippet/description
- INLINECODE3 - Array of search engines that returned this result
- INLINECODE4 - Relevance score (higher = better)
- INLINECODE5 - Result category
Shell Function
Add to your .zshrc or .bashrc:
CODEBLOCK6
Usage: INLINECODE8
Docker Management
CODEBLOCK7
Troubleshooting
Container won't start:
CODEBLOCK8
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
SearXNG 搜索技能
使用自托管的SearXNG实例搜索网络。这是一款尊重隐私的元搜索引擎,聚合来自Google、DuckDuckGo、Brave、Startpage以及70多个其他引擎的搜索结果。
前置条件
SearXNG在本地或服务器上运行。快速Docker部署:
bash
mkdir -p ~/Projects/searxng/searxng
cd ~/Projects/searxng
创建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
BASEURL=http://localhost:8080/
restart: unless-stopped
EOF
创建启用JSON API的settings.yml
cat > searxng/settings.yml << EOF
use
defaultsettings: 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
启动SearXNG
docker compose up -d
配置
设置SearXNG URL(默认为http://localhost:8080):
bash
export SEARXNG_URL=http://localhost:8080
使用示例
基础搜索
bash
curl http://localhost:8080/search?q=your+query&format=json | jq .results[:5]
按类别搜索
bash
通用网页搜索
curl http://localhost:8080/search?q=query&categories=general&format=json
图片
curl http://localhost:8080/search?q=query&categories=images&format=json
新闻
curl http://localhost:8080/search?q=query&categories=news&format=json
视频
curl http://localhost:8080/search?q=query&categories=videos&format=json
IT/技术文档
curl http://localhost:8080/search?q=query&categories=it&format=json
科学/学术
curl http://localhost:8080/search?q=query&categories=science&format=json
按语言/地区搜索
bash
curl http://localhost:8080/search?q=query&language=en-US&format=json
curl http://localhost:8080/search?q=query&language=de-DE&format=json
分页结果
bash
第2页(结果11-20)
curl http://localhost:8080/search?q=query&pageno=2&format=json
响应格式
每个结果包含:
- - title - 结果标题
- url - 结果链接
- content - 摘要/描述
- engines - 返回该结果的搜索引擎数组
- score - 相关性评分(越高越好)
- category - 结果类别
Shell函数
添加到您的.zshrc或.bashrc中:
bash
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
}
使用方法:searxng how to make sourdough bread
Docker管理
bash
启动
cd ~/Projects/searxng && docker compose up -d
停止
docker compose down
查看日志
docker compose logs -f searxng
重启
docker compose restart
故障排除
容器无法启动:
bash
docker compose logs searxng
JSON格式无法使用:
确保在settings.yml中包含formats: [html, json]
没有结果:
某些引擎可能受到速率限制。检查日志中的错误信息。
为什么选择SearXNG?
- - 隐私保护:无追踪、无广告、无数据收集
- 聚合搜索:整合70多个搜索引擎的结果
- 自托管:您的数据保留在您的机器上
- API支持:提供JSON输出用于自动化
- 免费使用:无需API密钥,无速率限制