vchord_bm25
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
vchord_bm25 | 0.3.0 | FTS | AGPL-3.0 | Rust |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2160 | vchord_bm25 | No | Yes | Yes | Yes | No | No | bm25_catalog |
bm25 am conflicts with pg_textsearch and pg_search, build require clang upgrade.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.3.0 | 1817161514 | vchord_bm25 | - |
| RPM | PIGSTY | 0.3.0 | 1817161514 | vchord_bm25_$v | - |
| DEB | PIGSTY | 0.3.0 | 1817161514 | postgresql-$v-vchord-bm25 | - |
Build
You can build the RPM / DEB packages for vchord_bm25 using pig build:
Install
You can install vchord_bm25 directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources:
- 0.3.0 README
- Control file
- 0.3.0 SQL objects
- Query settings
- 0.3.0 migration
- 0.3.0 release
- Tokenizer installation
- Tokenizer models
vchord_bm25 provides BM25 ranking with a sparse token-frequency type and the bm25 index access method. Tokenization is supplied separately, commonly by pg_tokenizer. Extension objects live in the fixed bm25_catalog schema, and creation requires superuser privileges.
Core Workflow
The example uses pg_tokenizer, which requires preloading and a restart. Preserve existing entries in the preload list:
The index supplies corpus statistics to to_bm25query; the score from <&> is negative, so ascending order returns greater relevance first. Use the same tokenizer/model for documents and queries. Update stored token vectors when source text changes, or use the tokenizer’s maintenance-trigger helper. Changing the vocabulary requires retokenizing stored documents before rebuilding their index.
Types, Functions, and Search Limits
bm25vectorstores token IDs and frequencies; the integer-array cast aggregates duplicate IDs and discards token order.bm25querybinds the query vector to an index.to_bm25query(regclass, bm25vector)constructs it;bm25_opsis the index operator class.bm25_catalog.bm25_limitdefaults to 100 and limits candidates returned by the index. Increase it for larger SQL limits or restrictive filters; changing SQL LIMIT alone does not increase this candidate budget.bm25_catalog.enable_indexcontrols use of the index;bm25_catalog.enable_prefiltercontrols prefiltering. Both default to true.bm25_catalog.segment_growing_max_page_sizedefaults to 4096 pages before sealing a growing segment.
The access-method name is global: this extension cannot coexist in a database with another extension that creates the same bm25 access method, including pg_textsearch and the compatibility alias in pg_search. Sparse frequencies do not preserve positions for phrase matching. Chinese text can use a custom corpus model with a Jieba pre-tokenizer; Japanese Lindera support depends on the tokenizer build and dictionary configuration.
Upgrade to 0.3.0
The 0.2.2-to-0.3.0 migration adds bm25_page_inspect(regclass, integer), returning diagnostic page text. The release changes sealed-segment page allocation for small tokens and does not document a mandatory index rebuild. Install matching extension files before updating database objects; replacing the preloaded tokenizer library also requires a restart. Keep tokenization and ranking upgrades compatible and check representative query results.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)