Skip to content
aicoolies logo
TigerData logo

pg_textsearch

BM25 full-text search extension for PostgreSQL

pg_textsearch is a PostgreSQL extension from Timescale that adds BM25 relevance-ranked full-text search directly inside Postgres. Using the same ranking algorithm as Elasticsearch and Lucene, it provides search-engine quality results without requiring a separate search cluster — particularly valuable for developers building RAG pipelines on PostgreSQL who want semantic-quality ranking alongside pgvector.

About pg_textsearch

pg_textsearch is a PostgreSQL extension developed by Timescale that brings BM25 relevance-ranked full-text search directly into Postgres. While PostgreSQL's built-in tsvector and pg_trgm provide basic text search capabilities, they use TF-IDF style ranking that degrades at scale and lacks the sophisticated relevance scoring that users expect from modern search experiences. pg_textsearch adds BM25 — the same ranking algorithm powering Elasticsearch and Apache Lucene — as a native Postgres operator, enabling search-engine quality results without deploying and maintaining a separate search infrastructure.

The extension introduces a clean operator syntax where you simply write ORDER BY content <@> 'search terms' to get BM25-ranked results. Block-Max WAND optimization ensures efficient top-k query execution even over large tables, and the implementation integrates with PostgreSQL's query planner for optimal performance. For developers building RAG pipelines on PostgreSQL — already using pgvector for semantic similarity search — pg_textsearch adds the keyword-based relevance layer that makes hybrid search possible within a single database, eliminating the need to synchronize data between Postgres and Elasticsearch.

Released under the PostgreSQL license by Timescale, a well-funded infrastructure company, the extension has gained rapid attention with over 3,500 GitHub stars and a Hacker News launch that hit 180 points. The combination of pgvector for vector similarity and pg_textsearch for BM25 ranking gives PostgreSQL a complete hybrid search stack that rivals purpose-built search engines — an increasingly attractive proposition as teams look to reduce operational complexity by consolidating on fewer database systems.

Pricing & Platform Specs

Pricing Summary

100% free and open source under the PostgreSQL License ($0 software cost). pg_textsearch is Timescale's high-performance BM25 full-text and hybrid search extension for PostgreSQL with zero software licensing fees.

full pricing breakdown →

Supported Platforms

PostgreSQL extension. Works on any platform where PostgreSQL runs. Compatible with pgvector for hybrid search.

Explore categories, tags & use cases

Lightning-fast, open-source search engine — a developer-friendly Algolia alternative.

Meilisearch is an open-source, lightning-fast search engine written in Rust. Designed as a developer-friendly alternative to Algolia with typo tolerance, faceted search, filtering, and sorting out of the box. Sub-50ms response times. Easy to deploy and configure with a RESTful API.

freemiumOpen Source

Open-source search engine — fast, typo-tolerant, easy to use.

Typesense is an open-source, typo-tolerant search engine optimized for instant search experiences. Written in C++ for maximum performance. Features built-in vector search for semantic/hybrid queries, geo-search, faceting, and curation. Popular for e-commerce search, documentation sites, and SaaS applications.

Open Source

Vector similarity search for PostgreSQL

pgvector is an open-source PostgreSQL extension with 22K+ GitHub stars adding vector similarity search to your existing Postgres database. Store embeddings alongside relational data, perform exact and approximate nearest neighbor search using L2, inner product, cosine, and L1 metrics. Supports HNSW and IVFFlat indexes for fast similarity queries at scale. Eliminates the need for a separate vector database by bringing vector capabilities into existing PostgreSQL infrastructure.

Open Source

Side-by-Side Comparisons

Community experience

Sources & verification

Sources checked
Content verified

Verification dates are editorial checks. Routine CMS saves and automatic updatedAt timestamps do not advance them.

FAQ

What is pg_textsearch?

pg_textsearch is a PostgreSQL extension from Timescale that adds BM25 relevance-ranked full-text search directly inside Postgres. Using the same ranking algorithm as Elasticsearch and Lucene, it provides search-engine quality results without requiring a separate search cluster — particularly valuable for developers building RAG pipelines on PostgreSQL who want semantic-quality ranking alongside pgvector.

Is pg_textsearch free?

Yes — pg_textsearch is open source and free to use. 100% free and open source under the PostgreSQL License ($0 software cost). pg_textsearch is Timescale's high-performance BM25 full-text and hybrid search extension for PostgreSQL with zero software licensing fees.

Is pg_textsearch open source?

Yes — pg_textsearch is open source.

Is pg_textsearch still maintained?

Yes — pg_textsearch is active. Its listing was last verified on September 6, 2026.

What are the best pg_textsearch alternatives?

The first editor-selected pg_textsearch alternatives are Meilisearch, Typesense, pgvector.