Hybrid Search Implementation

作者 wshobson46891e7e60da無授權條款收錄於 2026年10月8日更新於 2026年10月8日

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

僅含說明AI & Agents
AI 產生的概覽

用於在檢索系統中結合向量相似度與關鍵字搜尋的模式。

功能
此技能提供混合搜尋架構的指引,將向量相似度與關鍵字搜尋結合。內容涵蓋融合方法,例如倒數排名融合、線性加權評分、交叉編碼器重排序與串聯過濾,並提供調校與評估的最佳實務。它會指向一個包含範本與完整範例的參考檔案。
適用情境
適用於實作 RAG 系統或搜尋引擎,且單純向量或單純關鍵字搜尋都無法提供足夠召回率的情況。也適合包含名稱、代碼等特定詞彙的查詢,以及領域專用詞彙的檢索。
執行需求
不需要任何指令碼或工具,僅為說明性技能。它會引用配套檔案 references/details.md 以取得範本與完整範例。

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

MethodDescriptionBest For
RRFReciprocal Rank FusionGeneral purpose
LinearWeighted sum of scoresTunable balance
Cross-encoderRerank with neural modelHighest quality
CascadeFilter then rerankEfficiency

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

來源與署名

來源:wshobson/agents位於plugins/llm-application-dev/skills/hybrid-search-implementation提交46891e7

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架