hybrid-search-implementation

Fuse vector similarity and keyword retrieval with RRF, linear combination, or cross-encoder reranking.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/ACGSpgp/ACGS --skill hybrid-search-implementation-acgspgp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hybrid-search-implementation
Source: https://github.com/ACGSpgp/ACGS/tree/main/.agent/workflows/llm-application-dev/1.2.1/skills/hybrid-search-implementation
Command: npx skills add https://github.com/ACGSpgp/ACGS --skill hybrid-search-implementation-acgspgp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires asyncpg, numpy, elasticsearch, sentence-transformers, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the limitations of relying on a single search method (either pure vector or pure keyword) by combining their strengths to achieve more comprehensive and accurate retrieval of information.

Core Features & Use Cases

  • Improved Recall: Combines semantic understanding (vector search) with exact matching (keyword search) to ensure relevant results are found, even if they don't perfectly match the query's semantic meaning or contain specific keywords.
  • Flexible Fusion: Offers multiple methods for combining search results, including Reciprocal Rank Fusion (RRF), linear combination, and cross-encoder reranking, allowing users to choose the best approach for their needs.
  • Use Case: When building a RAG system, using hybrid search ensures that queries with specific technical terms or product codes are retrieved accurately alongside semantically similar documents.

Quick Start

Implement hybrid search by combining vector and keyword search results using the Reciprocal Rank Fusion method.

Frequently Asked Questions about hybrid-search-implementation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is hybrid search in RAG systems and when do I need it?

Fusion methods for hybrid search include Reciprocal Rank Fusion (RRF), linear combination, and cross-encoder reranking. These techniques merge vector similarity scores with keyword search rankings to balance semantic relevance and exact term matching accuracy.

How do I combine vector and keyword search results using RRF?

To combine vector and keyword search results using RRF, implement Reciprocal Rank Fusion to merge the ranked lists from both retrieval methods. This approach normalizes scores based on rank positions, ensuring balanced contributions from semantic and exact matches.

Does this hybrid search implementation work with Elasticsearch and sentence-transformers?

Yes, this hybrid search implementation works with Elasticsearch for keyword-based retrieval and sentence-transformers for generating vector embeddings. It also relies on asyncpg and numpy to manage database connections and perform numerical computations for result fusion.

Why does pure vector search miss specific domain vocabulary queries?

Pure vector search misses specific domain vocabulary queries because semantic embeddings often generalize exact technical terms or product codes. Hybrid search overcomes this by combining vector similarity with keyword-based exact matching to ensure precise vocabulary retrieval.

What are the limitations of using cross-encoder reranking for search fusion?

Cross-encoder reranking for search fusion provides high accuracy but introduces latency limitations due to its pairwise scoring mechanism. While it effectively refines merged vector and keyword results, this computational overhead makes it less suitable for real-time or large-scale retrieval pipelines.