hybrid-lexical-semantic

Fuse BM25 lexical relevance with vector semantic similarity in pgsv.hybrid_search.

Updated Apr 22, 2026
One-click install
npx skills add https://github.com/Mercurium-Analytics/pg-search-vector --skill hybrid-lexical-semantic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hybrid-lexical-semantic
Source: https://github.com/Mercurium-Analytics/pg-search-vector/tree/main/skills/hybrid-lexical-semantic
Command: npx skills add https://github.com/Mercurium-Analytics/pg-search-vector --skill hybrid-lexical-semantic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Combines keyword and semantic search to improve retrieval quality by fusing BM25 lexical relevance with vector similarity.

Core Features & Use Cases

  • Fusion of BM25 lexical relevance and vector-based ranking for documents, products, and knowledge bases.
  • Supports high-precision retrieval in enterprise search scenarios with noisy text or multi-language content.
  • Use Case: Imagine a knowledge base where users search for policies and related documents and want both exact term matches and semantic results.

Quick Start

Run the hybrid search query against your documents table to retrieve top results by fusing BM25 and vector similarity.

Frequently Asked Questions about hybrid-lexical-semantic

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

FAQPage Schema
How do I combine keyword and semantic search in Postgres?

Hybrid search combines BM25 keyword relevance and vector semantic similarity using reciprocal rank fusion. This technique merges exact term matching with paraphrase handling to improve retrieval quality in enterprise search.

What do I need to set up before running a hybrid search query?

You need a BM25 index on your text column, a vector index on your embedding column, and a shared primary key across both indexes. You then pass the query text and embedding vector to a single hybrid search function call.

When should I use hybrid search instead of just vector similarity?

Use hybrid search when both exact matches and semantic paraphrase handling matter. It delivers high-precision retrieval across noisy text or multi-language content where relying solely on vector similarity might miss critical keywords.

Does hybrid search work for enterprise knowledge bases and product catalogs?

Yes, hybrid search supports high-precision retrieval for enterprise knowledge bases and product catalogs. Fusing BM25 and vector rankings ensures users find both exact policy terms and semantically related documents.

How does reciprocal rank fusion improve BM25 and vector search results?

Reciprocal rank fusion improves search results by combining the ranking signals from BM25 and vector similarity. This fusion balances lexical exactness with semantic context, yielding higher quality retrieval than either method alone.