Combine vector and keyword search for improved retrieval. Use when implementing RAG systems, building search engines, or when neither approach alone provides sufficient recall.
Install
npx agentshq add wshobson/agents --agent hybrid-search-implementationCombine vector and keyword search for improved retrieval. Use when implementing RAG systems, building search engines, or when neither approach alone provides sufficient recall.
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.