Show HN: Postgres extension for BM25 relevance-ranked full-text search

pg_textsearch is a modern ranked text search extension for PostgreSQL, featuring BM25 ranking, Block-Max WAND optimization, and parallel index builds for high-performance information retrieval.
Modern ranked text search for Postgres.
- Simple syntax:
ORDER BY content <@> 'search terms' - BM25 ranking with configurable parameters (k1, b)
- Works with Postgres text search configurations (english, french, german, etc.)
- Fast top-k queries via Block-Max WAND optimization
- Parallel index builds for large tables
- Supports partitioned tables
- Best in class performance and scalability
Status: v1.0.0 - Production ready. pg_textsearch supports PostgreSQL 17 and 18.
Installation involves cloning the repository, running make install, and adding pg_textsearch to shared_preload_libraries in postgresql.conf.
Usage example:
CREATE INDEX docs_idx ON documents USING bm25(content) WITH (text_config='english');
SELECT * FROM documents ORDER BY content <@> 'database system' LIMIT 5;
The extension supports both pre-filtering and post-filtering strategies, similar to pgvector. For large datasets, it offers parallel index builds and a bm25_force_merge function to consolidate index segments for better query performance.
Source: Hacker News












