← Back to Skills Marketplace
mayf3

Smart Search

by mayf3 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
42
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install mayf3-smart-search
Description
Multi-engine search with auto-fallback, result parsing, and quality scoring via DDGS local library. Use when: searching the web, gathering information, marke...
README (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 ⭐⭐⭐⭐ ⭐⭐⭐⭐
Usage Guidance
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.
Capability Tags
requires-sensitive-credentials
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install mayf3-smart-search
  3. After installation, invoke the skill by name or use /mayf3-smart-search
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug mayf3-smart-search
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 42 downloads so far.

How do I install Smart Search?

Run "/install mayf3-smart-search" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Smart Search free?

Yes, Smart Search is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Smart Search support?

Smart Search is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Smart Search?

It is built and maintained by mayf3 (@mayf3); the current version is v1.0.0.

💬 Comments