
Combines vector similarity search with keyword matching using reciprocal rank fusion and linear score combination. Includes PostgreSQL implementations with pgvector for when you need both semantic understanding and exact term matching in RAG systems. The templates handle score normalization, metadata filtering, and cross-encoder reranking. Most useful when pure vector search misses specific names or technical terms that users search for literally. The RRF approach works well out of the box, while the weighted linear combination gives you more control when you know your data patterns.
$ npx -y skills add wshobson/agents --skill hybrid-search-implementation --agent claude-codeInstalls into .claude/skills of the current project.
Patterns for combining vector similarity and keyword-based search.
Query → ┬─► Vector Search ──► Candidates ─┐
│ │
└─► Keyword Search ─► Candidates ─┴─► Fusion ─► Results
| 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 |
Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.
Sponsors