Repository navigation
pgokf 0.1.15
A PostgreSQL-licensed BM25 backend. The bm25 search backend now runs on
a selectable provider, and Tiger Data's pg_textsearch (PostgreSQL license,
PostgreSQL 17 and 18) joins ParadeDB's pg_search. The Docker image bundles
pg_textsearch on the 17 and 18 images and no longer bundles pg_search by
default. ALTER EXTENSION pgokf UPDATE TO '0.1.15' adds one policy column
with its default and touches no existing row.
Added
bm25_providerpolicy key (auto|pg_textsearch|pg_search,
defaultauto, which preferspg_textsearchwhen installed). Both
providers name their index access methodbm25and cannot coexist in one
database, so resolution is unambiguous.rebuild_search_index()builds the
resolved provider's index;search_index_status()reportsbm25.provider
andbm25.provider_setting;health().bm25_readyaccepts either provider.pg_textsearchbackend. One expression index over title, description,
and body with the catalog's text-search configuration (baked into the
index; rebuild after changing it). A page is served by the provider's
index-ordered top-k scan (ORDER BY <expr> <@> to_bm25query(...) LIMIT n)
with the structured filters, the keyset predicate, and row-level security
applied as ordinary quals on that scan - inline with invoker rights, no
privileged helper - then orderedrank DESC, bundle_id, concept_idin SQL.
Rows tying the page's last rank are read past the page so keyset pages
tile exactly, up to 256 tied rows per boundary (beyond that aWARNING
and approximate paging). Query text is plain terms, as it already was on
pg_search(neither provider interprets web-search operators). Covered by
new in-database tests (the query shape is asserted to plan as abm25
index scan) that run whereverpg_textsearchis preloaded, including CI's
PostgreSQL 17 and 18 legs.- Image:
WITH_PG_TEXTSEARCH(defaultauto: installed on 17 and 18 from
the pinned, checksum-verified release package via the shared
fetch-pg-textsearch.sh, with its PostgreSQL-license notice under
/usr/share/doc; skipped elsewhere). CI builds the 17/18 images with
WITH_PG_TEXTSEARCH=1and the smoke test requires a provider there, so a
stale checksum table fails the build rather than publishing a provider-less
image.WITH_PG_SEARCHnow defaults to0; the ParadeDB build path remains
available.pgokf-restoreskips apg_textsearchextension entry the
target cannot replay, as it already did forpg_search. The compose stack
preloadspg_textsearch.
Changed
search_index_status().bm25.availableandhealth().bm25_readynow
follow the providerbm25_providerresolves to (they were "pg_search
installed"), so a pinned provider that is missing shows as unavailable
even when the other one is present, and the fallback warning names what
is installed instead.concept_search,find_similar, andconcept_search_hybridare now
PARALLEL RESTRICTED(executed in the leader of a parallel plan, never in
a worker): the BM25 providers declare their scoring parallel-unsafe, and
these functions run it through SPI. Results and signatures are unchanged;
the upgrade script relabels the installed functions.- Documentation for search backends, configuration, packaging, and the
compose deployment covers provider selection and the licensing difference. - Compose stack:
shared_preload_librariesnow namespg_textsearch
instead ofpg_search(overridable through the newPGOKF_PRELOAD
variable, e.g.pgokf,pg_cronfor a 15/16/19 image), and the ParadeDB-only
paradedb.planner_warningssetting is gone. An older compose file that still preloadspg_search
will not start the 0.1.15 image (the library is no longer in it): update
the preload line, or build the image withWITH_PG_SEARCH=1 WITH_PG_TEXTSEARCH=0to keep ParadeDB. A database that haspg_search
created must drop it (on the old image,DROP EXTENSION pg_search CASCADE)
beforepg_textsearchcan be created; the step-by-step migration is in
docs/compose-deployment.md. - Test harness: the in-database tests that need a preloaded BM25 provider
now run whenPGOKF_TEST_PRELOADnames it (pgrx starts its own instance,
so the operator's cluster configuration never reached them, and they had
been skipping silently), and fail instead of skipping when the requested
provider is unusable.
Images: ghcr.io/logicocean/pgokf:0.1.15-pg{15,16,17,18} and ghcr.io/logicocean/pgokf-companions:0.1.15 (linux/amd64 + linux/arm64). Homebrew: brew tap logicocean/pgokf && brew install pgokf.