aicoolies logo
TigerData logo
TigerData logo

pg_textsearch

BM25 full-text search extension for PostgreSQL

open sourceupdated Jul 28, 2026

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.

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

Free and open source (PostgreSQL License). Works with any PostgreSQL 14+ installation.

Platforms

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

Categories

Tags

Use Cases

Related Tools

computed discovery: shared active categories · kept separate from editor-verified Alternatives

Cloudflare logo

Cloudflare Vectorize

Edge-native vector database for Workers and AI applications

Cloudflare Vectorize is Cloudflare’s managed vector database for Workers and edge AI applications. It is distinct from the existing Cloudflare Workers tool page: Workers is the compute runtime, while Vectorize is the embedding index and vector-query layer used to add semantic retrieval to Cloudflare-hosted apps.

freemium
Upstash Vector logo

Upstash Vector

Serverless vector database with pay-as-you-go API pricing

Upstash Vector is a managed serverless vector database for RAG, semantic search, and embedding lookup. It is separate from the existing Upstash platform record in the aicoolies catalog: this slug covers the Vector product line, not the broader Redis, Kafka, or QStash platform.

freemium
OpenSearch logo

OpenSearch

Open-source search engine with vector and hybrid retrieval

OpenSearch is an Apache-2.0 distributed search engine with native vector-search support for teams that want BM25, filters, aggregations, and k-NN retrieval in the same search stack. It is distinct from Elasticsearch in the aicoolies catalog: OpenSearch is the AWS-backed open fork with its own docs, plugin path, and serverless deployment options.

Open Source
Supabase MCP logo

Supabase MCP

MCP server for connecting AI assistants to Supabase projects

Supabase MCP is Supabase's Apache-2.0 server for connecting AI assistants to Supabase projects. It can expose database, configuration, and project-management workflows to MCP clients such as Cursor, Claude, and Windsurf, while the official docs emphasize permission and security review before production use, SQL changes, or high-privilege database access.

Open SourceTelemetry
Deep Lake logo

Deep Lake

AI data runtime for multimodal datasets and vector search

Deep Lake is an open-source AI data runtime from Activeloop for storing, versioning, and querying multimodal data and embeddings. It fits teams building RAG, training, evaluation, or dataset-heavy agent workflows that need a bridge between vector search, structured metadata, and large image, text, audio, or video collections.

Open Source
SeekDB logo

SeekDB

AI-native state store with hybrid vector and full-text search

SeekDB is an open-source AI-native state store from the OceanBase ecosystem that combines MySQL-compatible data access with hybrid vector and full-text retrieval. It targets agent and AI application teams that need embedded or server deployment, copy-on-write style sandboxes, and searchable state without gluing together several separate storage layers.

Open Source

Comparisons

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. Free and open source (PostgreSQL License). Works with any PostgreSQL 14+ installation.

Is pg_textsearch open source?

Yes — pg_textsearch is open source.

What are the best pg_textsearch alternatives?

The top editor-verified pg_textsearch alternatives are Meilisearch, Typesense, pgvector.