mcpField
H
hybrid-search-implementation

hybrid-search-implementation

github.com/wshobsonData & databases41.9k10.9k installsUpdated 2w ago
Repository

About hybrid-search-implementation

A skill for engineers combining vector similarity and keyword search in retrieval systems. It outlines fusion and reranking approaches for queries that need both semantic matches and exact terms.

Key features

  1. 01Vector and keyword search
  2. 02RRF and weighted-score fusion
  3. 03Cross-encoder reranking
  4. 04Cascade retrieval pattern
  5. 05Search tuning and evaluation

Use cases

  1. 01Improving recall in RAG systems
  2. 02Finding exact names or codes
  3. 03Searching domain-specific vocabulary

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/wshobson/agents --skill hybrid-search-implementation

After installing, type/hybrid-search-implementationin Claude Code to confirm it loaded.

Bundled filesreferences/details.md

Details

From the project README

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

Comments

Markdown supported