pg_textsearch is a PostgreSQL extension that adds BM25 relevance-ranked full-text search to Postgres.
The extension solves the problem of ranking search results by relevance rather than just matching presence or absence of terms. It implements the BM25 algorithm, a probabilistic ranking function widely used in information retrieval. The tool adds a simple `<@>` operator for ordering results by BM25 score, with configurable parameters k1 and b to tune term frequency saturation and length normalization. It supports PostgreSQL text search configurations for language-aware tokenization, and uses Block-Max WAND to accelerate top-k queries without scoring all matching documents. Index builds can run in parallel on large tables.
The extension suits projects that need ranked full-text search within PostgreSQL without external search infrastructure. It works with expression indexes on JSONB fields or multiple columns, partial indexes to search subsets of rows, and multilingual tables through language-specific text search configurations. The tool supports PostgreSQL 17 and 18, with best-effort support for PostgreSQL 19 beta. Pre-built binaries are available for Linux on amd64 and arm64 architectures, and source builds are supported. The README does not compare this tool to alternatives.
The project's issue tracker is maintained primarily by its own members rather than driven by external user reports, suggesting internal prioritization of the roadmap. Maintainers respond to new issues and pull requests within a few days. Work focuses on bugs, enhancements, and performance improvements.