跳到正文
Skillpedia
智能体41k · #6721

hybrid-search-implementation

它能做什么

这个技能会教你如何混合两种搜索方式:一种是理解含义的搜索(向量搜索),另一种是查找精确词语的搜索(关键词搜索)。这样可以让你更全面地找到所需信息。

适用场景

  • ✓在构建基于文档回答问题的系统时。
  • ✓当你需要搜索既能匹配含义,又能匹配特定术语时。
  • ✓如果纯粹基于含义的搜索遗漏了你知道确实存在的重要结果时。

技能链接

https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/hybrid-search-implementation/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/hybrid-search-implementation/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我怎样才能把含义搜索和关键词搜索结合起来,以提升搜索结果?”

每周 5 个新技能,1 分钟读完。

工作原理

思路是同时把你的查询发送给两个搜索系统。一个负责理解含义,另一个负责查找精确的词语。然后把两边的结果合并起来,得到最佳答案。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Hybrid Search Implementation

Patterns for combining vector similarity and keyword-based search.

When to Use This Skill

  • Building RAG systems with improved recall
  • Combining semantic understanding with exact matching
  • Handling queries with specific terms (names, codes)
  • Improving search for domain-specific vocabulary
  • When pure vector search misses keyword matches

Core Concepts

1. Hybrid Search Architecture

Query → ┬─► Vector Search ──► Candidates ─┐
        │                                  │
        └─► Keyword Search ─► Candidates ─┴─► Fusion ─► Results

2. Fusion Methods

Method Description Best For
RRF Reciprocal Rank Fusion General purpose
Linear Weighted sum of scores Tunable balance
Cross-encoder Rerank with neural model Highest quality
Cascade Filter then rerank Efficiency

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Tune weights empirically - Test on your data
  • Use RRF for simplicity - Works well without tuning
  • Add reranking - Significant quality improvement
  • Log both scores - Helps with debugging
  • A/B test - Measure real user impact

Don'ts

  • Don't assume one size fits all - Different queries need different weights
  • Don't skip keyword search - Handles exact matches better
  • Don't over-fetch - Balance recall vs latency
  • Don't ignore edge cases - Empty results, single word queries
常见问题

什么是向量搜索?

它是一种能理解词语和短语含义的搜索,即使用词不同,也能找到讨论同一主题的文本。

什么是关键词搜索?

它是传统的搜索方式,会查找你输入的精确词语。

什么是“融合”(fusion)?

它是把两种搜索(向量搜索和关键词搜索)的结果合并起来的过程,从而得到更准确的最终结果列表。

详情

作者的原始描述

Combine vector and keyword search for improved retrieval. Use when implementing RAG systems, building search engines, or when neither approach alone provides sufficient recall.

repo: wshobson/agents

热度

GitHub 星标
41k
排名
#6721
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能