← 返回 Skills 市场
mayf3

Smart Search

作者 mayf3 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
42
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install mayf3-smart-search
功能描述
Multi-engine search with auto-fallback, result parsing, and quality scoring via DDGS local library. Use when: searching the web, gathering information, marke...
使用说明 (SKILL.md)

Smart Search

多引擎搜索集成:DDGS 本地库优先,自动语言检测,自动降级,结构化结果,搜索→提取一体化。

设计原则

  1. 本地 DDGS 优先(结构化结果、多后端、中英文)
  2. 自动语言检测(CJK 查询自动选 bing 优先链,英文自动选 brave 优先链)
  3. 自动降级(引擎挂了自动换下一个)
  4. 搜索→提取一体化(DDGS 搜索 + extract() 获取全文)
  5. 超时保护--timeout 线程安全,--type all 可用)
  6. 垂直搜索优先(先选对战场,再选武器)

快速参考

唯一必记规则:--fallback,脚本会自动根据查询语言选择最优后端链(中文→bing优先,英文→brave优先)。需要全文时加 --extract。需要强制指定语言时用 --lang en/cn。脚本化调用时用 --urls-only 只输出 URL。

引擎优先级

Tier 0:DDGS 本地库(首选)

后端 速度 适用场景 状态
brave ~1.1-1.7s 英文首选 ✅ 稳定
bing ~1.5s 中文首选 ✅ 稳定
yandex ~1.4s 中文备选 ⚠️ EN 搜索有时失败
yahoo ~1.1s 备选 ✅ 稳定

DDGS 返回结构化 JSON(title/href/body),无需手动解析 HTML。 extract() 方法可直接获取 URL 全文 markdown(~0.5s),搜索→提取一站式。 ⚠️ brave 短时间连续搜索(>4次)可能返回空结果,切换到 yandex/yahoo。 ⚠️ threads() 是 DDGS 类变量(控制并发线程数),不是搜索方法,不可调用。

Tier 1:web_fetch 降级方案

引擎 响应时间 适用场景
Bing CN ~500ms 降级首选,通用搜索
360 ~1200ms 英文搜索意外好
Sogou ~1800ms 微信内容,长文搜索

不可用引擎(反爬拦截)

DuckDuckGoBrave SearchGoogle百度 — web_fetch 被反爬拦截,但 DDGS 库可通过 brave/bing 后端获取结果。

使用方法

方法 1:DDGS 脚本搜索(首选)

# 通用搜索(自动检测语言)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "搜索关键词" --fallback -m 5

# 版本信息
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --version

# 强制指定语言(覆盖自动检测)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI agent" --lang cn --fallback  # 强制中文链
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "人工智能" --lang en --fallback  # 强制英文链

# 指定后端 + JSON 输出
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" -b brave -o json

# 搜索类型:text/news/videos/images/books
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI news" --type news --fallback -m 5
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI agent" --type all -m 3
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "AI agent" --type all+ -m 3  # 含 images
# ⚠️ --type books 结果多来自影子图书馆(Library Genesis 等),谨慎用于版权内容
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "machine learning" --type books

# 全文提取(--extract-length 控制输出长度,默认2000字符)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "topic" --extract
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --extract-url "https://example.com/article"
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --extract-url "https://example.com/article" --extract-length 5000

# 自动降级 + 语言检测(中文→bing优先,英文→brave优先)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --fallback -m 5

# 超时保护(防止搜索挂死)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --timeout 15 --fallback

# 静默模式(隐藏 stderr 重试/超时消息)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --quiet --fallback

# 只输出 URL(一行一条,方便管道处理)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --urls-only --fallback
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "query" --urls-only --type all --fallback

# 时间过滤(d=天, w=周, m=月, y=年)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py -q "最新新闻" -t d --fallback

# 批量搜索(自动语言检测+后端轮换)
python3.12 {{SKILL_DIR}}/scripts/ddgs_search.py --batch-file queries.txt -m 3 -o json

方法 2:DDGS Python API(嵌入脚本时)

from ddgs import DDGS
with DDGS() as d:
    # 搜索
    results = list(d.text("query", max_results=5, backend="brave"))
    for r in results:
        print(r["title"], r["href"], r["body"])

    # 搜索后提取全文
    content = d.extract(results[0]["href"], fmt="text_markdown")
    print(content["content"])

    # 其他类型
    news = list(d.news("AI agent", max_results=3))
    images = list(d.images("AI agents", max_results=3))
    videos = list(d.videos("AI agents", max_results=3))
    books = list(d.books("machine learning", max_results=3))

方法 3:web_fetch 降级(紧急场景)

// 中文搜索 → Bing CN(500ms,非结构化)
// 必须用 extractMode: "text",markdown 模式会过滤掉搜索结果
web_fetch({"url": "https://cn.bing.com/search?q=Python+教程", "extractMode": "text"})

高级语法(web_fetch 场景)

// 站内搜索
web_fetch({"url": "https://cn.bing.com/search?q=site:github.com+react", "extractMode": "text"})
// 精确匹配
web_fetch({"url": "https://cn.bing.com/search?q=\"exact+phrase\"", "extractMode": "text"})
// 时间过滤(after: 已验证有效)
web_fetch({"url": "https://cn.bing.com/search?q=\"RAG\"+after:2025-06-01", "extractMode": "text"})

详细语法实测结果和 Bing CN 关键词碰撞问题,见 references/advanced-syntax.md

自动降级策略

--fallback 自动语言检测: 中文查询 → bing 优先链,英文查询 → brave 优先链。

中文降级链: bing → yandex → yahoo → brave 英文降级链: brave → yandex → yahoo → bing

DDGS 全部失败时: DDGS → web_fetch Bing CN → web_fetch 360 → web_fetch Sogou

判断失败条件:DDGS 抛异常、返回空、超时(>15s 或 --timeout 值)

多引擎交叉验证

重要搜索用 2-3 个引擎验证:

const r1 = web_fetch({"url": "https://cn.bing.com/search?q=keyword", "extractMode": "text"})
const r2 = web_fetch({"url": "https://www.so.com/s?q=keyword", "extractMode": "text"})
// 取交集作为高可信结果

最佳引擎组合

场景 推荐组合
通用英文搜索 DDGS brave 单后端
通用中文搜索 DDGS bing 单后端
需要验证的搜索 DDGS brave + bing
微信/公众号内容 web_fetch Sogou + WeChat
紧急快速搜索 web_fetch Bing CN(500ms)
新闻搜索 DDGS news()

关键词构造技巧

  1. 用独特、高区分度的词,而非自然语言长句
    • SearXNG JSON API format
    • 请问SearXNG的JSON API格式是什么样的
  2. 高权重来源优先site:edu.cn 量子计算
  3. 注意时效性:搜索结果不一定反映最新信息
  4. 索引延迟:新内容可能几天后才被索引

常见问题

问题 解决
结果为空 web_fetch 改用 extractMode: "text"
国际引擎失败 换国内引擎,或用 DDGS
结果不相关 加引号精确匹配或用 site:
时间过滤 after: 操作符(已验证有效)
brave 连续搜索空 切换到 yandex/yahoo,或等几分钟

详细参考

实测数据摘要(2026-06-04)

引擎 响应时间 web_fetch 英文质量 中文质量
DDGS brave ~1.1-1.7s N/A(库) ⭐⭐⭐⭐⭐ ⭐⭐⭐
DDGS bing ~1.5s N/A(库) ⭐⭐⭐⭐ ⭐⭐⭐⭐
DDGS yandex ~1.4s N/A(库) ⭐⭐(EN 不稳定) ⭐⭐⭐
DDGS extract() ~0.5s N/A(库)
Bing CN ~500ms ⭐⭐ ⭐⭐⭐⭐
360 ~1200ms ⭐⭐⭐⭐ ⭐⭐⭐⭐
安全使用建议
Install only if you are comfortable with search queries and URLs being sent to external search engines or remote extraction services. Avoid using it for secrets, private/internal URLs, proprietary project names, or regulated data, and be cautious with --extract-url in environments that can reach internal services.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
The skill's search, fallback, typed search, batch search, and URL extraction capabilities align with its stated Smart Search purpose; the description mentions quality scoring, but the reviewed script mainly performs search/result formatting rather than security-sensitive scoring.
Instruction Scope
Activation phrases such as 'search' and 'look up' are broad, but they are coherent for a web-search skill and the docs exclude internal file/code search; users should avoid invoking it with secrets or sensitive internal terms.
Install Mechanism
No installer, postinstall hook, dependency installation script, or automatic package mutation was found; the script only exits with a message to install ddgs if the library is missing.
Credentials
Network use is central to the skill: queries and requested URLs are sent to DDGS-backed engines or remote sites, and references mention optional web_fetch/curl fallbacks. This is proportionate for search but should be treated as external disclosure.
Persistence & Privilege
No persistence mechanism, background worker, privilege escalation, credential/session-store access, local indexing, or file writes were found; local file access is limited to a user-supplied batch query file.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install mayf3-smart-search
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /mayf3-smart-search 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of smart-search: a flexible, multi-engine search skill with auto language detection, fallback, and integrated result extraction. - Integrates DDGS local library for structured, high-quality search (brave/bing/yandex/yahoo backends). - Automatically detects query language and routes to optimal search engine (Chinese→bing, English→brave). - Auto-fallback: seamlessly switches engines on failure; includes web_fetch downgrade options. - One-step search and content extraction (markdown/fulltext) with script/API usage. - Supports advanced features: timeout protection, URL-only output, batch search, result type selection (text/news/images/videos/books). - Includes expert usage tips, best engine combinations, and troubleshooting guidance.
元数据
Slug mayf3-smart-search
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Smart Search 是什么?

Multi-engine search with auto-fallback, result parsing, and quality scoring via DDGS local library. Use when: searching the web, gathering information, marke... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 42 次。

如何安装 Smart Search?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install mayf3-smart-search」即可一键安装,无需额外配置。

Smart Search 是免费的吗?

是的,Smart Search 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Smart Search 支持哪些平台?

Smart Search 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Smart Search?

由 mayf3(@mayf3)开发并维护,当前版本 v1.0.0。

💬 留言讨论