# pgx-bm25 1.0: BM25 ranked full-text search as a native PostgreSQL index

DevFeed: [pgx-bm25 1.0: BM25 ranked full-text search as a native PostgreSQL index](<https://devfeed.tech/articles/pgx-bm25-1-0-bm25-ranked-full-text-search-as-a-native-postgresql-index-66588.md>)

Original publisher: [Read original article](<https://www.postgresql.org/about/news/pgx-bm25-10-bm25-ranked-full-text-search-as-a-native-postgresql-index-3396/>)

Author: PGX; Inc

Published: 2026-10-07T00:00:00Z

Content type: release

Language: en

Sources: [PostgreSQL news](<https://devfeed.tech/sources/postgresql-news.md>)

Topics: [search-engines](<https://devfeed.tech/topics/search-engines.md>), [libSQL](<https://devfeed.tech/topics/libsql.md>)

Tags: [bm25](<https://devfeed.tech/tags/bm25.md>), [full-text-search](<https://devfeed.tech/tags/full-text-search.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [search](<https://devfeed.tech/tags/search.md>)

## AI overview

PGX Inc. released pgx-bm25 1.0, a PostgreSQL extension that provides BM25-ranked full-text search through a native index access method. It supports PostgreSQL 17 and 18, with query features including Boolean matching, phrase and proximity search, and highlighted snippets. The index uses PostgreSQL's WAL, crash recovery, replication, and VACUUM mechanisms, and ranked top-N queries use block-max WAND.

## Source excerpt

PGX Inc. has released version 1.0 of pgx-bm25, an extension that adds Okapi BM25 ranked full-text search to PostgreSQL as a native index access method. It supports PostgreSQL 17 and 18, and installs as bm25_native. CREATE EXTENSION bm25_native; CREATE INDEX docs_bm25 ON docs USING bm25_native (body); SELECT id, bm25_score(ctid) AS score FROM docs WHERE body @@@ 'quick fox' ORDER BY body &@@ 'quick fox' LIMIT 10; @@@ selects the matching rows and &@@ orders them by relevance. The query runs as an ordered index scan; there is no Sort node. It is a PostgreSQL index The whole index lives in the index relation's own pages, so it gets WAL logging, crash recovery, and physical replication from core. VACUUM maintains it. There is no external search engine and no separate runtime to operate. The extension is written in C against the stock server headers and builds with PGXS; a C compiler and pg_config are the whole toolchain. Text is analyzed with PostgreSQL's own Snowball dictionaries, with the language set per index, so a search for negligent finds negligence. Ranked top-N queries use block-max WAND, so a typical LIMIT 10 search does not have to score every matching document. Query features Multi-column indexes with BM25F scoring: per-field boosts and per-field length normalization. k1, b, and the boosts can be changed with ALTER INDEX ... SET and take effect on the next scan, without a REINDEX. Exact phrases, and proximity search by token distance, ordered or unordered. Boolean queries (must, should, must_not), nested as needed. Prefix wildcards (judg*). Query-time boosts on any clause. Highlighted snippets with bm25_snippet(), HTML-escaped by default. Simple searches can be written as a text string. Everything else is composed from builder functions that produce a jsonb query tree, so user input always arrives as a value and never as query syntax: CREATE INDEX docs_bm25 ON docs USING bm25_native (title, summary, body) INCLUDE (id) WITH (key_field = 'id'); SELECT id, bm25