databases-storage

pgx-bm25 1.0 adds native BM25 full-text search to PostgreSQL

Key Takeaway

The pgx-bm25 extension introduces Okapi BM25 ranked full-text search as a native PostgreSQL index access method.

Summary

PGX Inc. has released version 1.0 of pgx-bm25, an extension that implements Okapi BM25 ranking directly within PostgreSQL. Supporting versions 17 and 18, the extension functions as a native index, utilizing PostgreSQL's existing WAL logging, crash recovery, and replication mechanisms. It eliminates the need for external search engines by integrating text analysis via Snowball dictionaries and optimizing top-N queries with the block-max WAND algorithm.

Technical capabilities of pgx-bm25

  • Implements Okapi BM25 and BM25F scoring for multi-column indexes.
  • Uses block-max WAND to optimize ranked top-N queries.
  • Supports Boolean queries (must, should, must_not), exact phrases, proximity searches, and prefix wildcards.
  • Allows adjusting k1 and b parameters via ALTER INDEX without requiring a REINDEX.
  • Integrates with PostgreSQL's Snowball dictionaries for language-aware analysis.
  • Built in C using PGXS for compatibility with standard server headers.

Why it matters

By providing a native, highly optimized search index, pgx-bm25 allows users to perform complex full-text searches without the operational overhead of managing a separate search engine runtime.

Original reference: www.postgresql.org →