postgres-hybrid-text-search

Official

Hybrid keyword and semantic search for PostgreSQL.

Authortimescale
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill enables developers to implement hybrid search by combining BM25 keyword search with semantic vector search to deliver more relevant results in PostgreSQL-driven applications. It helps AI-assisted tooling retrieve both exact-match results and conceptually related documents in a single query flow.

Core Features & Use Cases

  • Hybrid search: merge BM25 keyword relevance with vector-based semantic similarity using Reciprocal Rank Fusion (RRF).
  • Setup guidance: demonstrates enabling pg_textsearch, pgvector, and optional vector indexing methods, plus client-side fusion logic.
  • Use Cases: document search, product catalogs, knowledge bases, code search, and QA systems that require both precise terms and semantic understanding.

Quick Start

Enable the extensions and create a sample documents table with both text and vector columns, then perform BM25 and semantic searches in parallel and fuse results client-side via RRF. Example steps:

  • Enable extensions: CREATE EXTENSION IF NOT EXISTS vector; CREATE EXTENSION IF NOT EXISTS pg_textsearch;
  • Create sample table with id, content, embedding;
  • Create BM25 and HNSW indexes;
  • Run parallel queries and fuse results on the client.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: postgres-hybrid-text-search
Download link: https://github.com/timescale/pg-aiguide/archive/main.zip#postgres-hybrid-text-search

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.