hybrid-search-implementation

Fuse vector and keyword search results using Reciprocal Rank Fusion.

Updated Dec 23, 2025
One-click install
npx skills add https://github.com/drgaciw/academic-compliance-hub-glm --skill hybrid-search-implementation-drgaciw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hybrid-search-implementation
Source: https://github.com/drgaciw/academic-compliance-hub-glm/tree/main/agents/plugins/llm-application-dev/skills/hybrid-search-implementation
Command: npx skills add https://github.com/drgaciw/academic-compliance-hub-glm --skill hybrid-search-implementation-drgaciw

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 keyword or vector) by combining their strengths to achieve more comprehensive and accurate retrieval of information.

Core Features & Use Cases

  • Improved Recall: Combines semantic understanding with exact keyword matching to ensure more relevant results.
  • Flexible Fusion: Supports various methods like Reciprocal Rank Fusion (RRF), linear combination, and cross-encoder reranking.
  • Use Case: Implementing a RAG system where semantic search might miss specific product codes, but keyword search can find them, leading to better context for the LLM.

Quick Start

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

Frequently Asked Questions about hybrid-search-implementation

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

FAQPage Schema
How do I combine vector and keyword search to improve RAG retrieval accuracy?

Hybrid search combines vector and keyword search to improve RAG retrieval accuracy by fusing semantic understanding with exact term matching. You can implement this using Reciprocal Rank Fusion, linear combination, or cross-encoder reranking techniques.

What is Reciprocal Rank Fusion and how does it work for hybrid search?

Reciprocal Rank Fusion (RRF) is a hybrid search fusion method that merges result rankings from vector and keyword search methods. It calculates a combined score based on the reciprocal of each document's rank in the individual result lists, enhancing overall retrieval accuracy.

Does this hybrid search implementation work with Elasticsearch and PostgreSQL?

Yes, this hybrid search implementation works with both Elasticsearch and PostgreSQL. It provides specific templates for both platforms, allowing you to fuse vector and keyword search results directly within your existing asyncpg or Elasticsearch database environments.

Why does my semantic search miss exact product codes in my RAG system?

Semantic search misses exact product codes because it relies on vector embeddings for contextual meaning rather than exact term matching. Hybrid search solves this by combining vector search with keyword search, ensuring specific alphanumeric codes are successfully retrieved.

What's the best way to fuse vector and keyword search results for domain-specific information retrieval?

The best way to fuse vector and keyword search results is using hybrid search strategies like Reciprocal Rank Fusion, linear combination, or cross-encoder reranking. These methods leverage both semantic understanding and exact matching to yield highly accurate domain-specific retrieval.