Skip to content
pg_search

pg_search

pg_search : Full text search for PostgreSQL using BM25

Overview

ID Extension Package Version Category License Language
2100
pg_search
pg_search
0.23.1
FTS
AGPL-3.0
Rust
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
Schemas paradedb
See Also
pgroonga
pgroonga_database
pg_bestmatch
vchord_bm25
pg_bigm
zhparser
pg_tokenizer
pg_trgm

bm25 am conflicts with pg_textsearch; PG15-16 require shared_preload_libraries while PG17-18 do not.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
0.23.1
18
17
16
15
14
pg_search -
RPM
PIGSTY
0.23.1
18
17
16
15
14
pg_search_$v -
DEB
PIGSTY
0.23.1
18
17
16
15
14
postgresql-$v-pg-search -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 0.23.0
PIGSTY 0.23.0
PIGSTY 0.23.0
PIGSTY 0.23.0
PIGSTY 0.20.10
el8.aarch64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.10
el9.x86_64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.10
el9.aarch64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.10
el10.x86_64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
MISS
el10.aarch64
PIGSTY 0.22.6
PIGSTY 0.22.6
PIGSTY 0.22.6
PIGSTY 0.23.1
MISS
d12.x86_64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.7
d12.aarch64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.7
d13.x86_64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.5
d13.aarch64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.5
u22.x86_64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.7
u22.aarch64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.7
u24.x86_64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.7
u24.aarch64
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.23.1
PIGSTY 0.20.7
u26.x86_64
PIGSTY 0.23.0
PIGSTY 0.23.0
PIGSTY 0.23.0
PIGSTY 0.23.0
MISS
u26.aarch64
PIGSTY 0.23.0
PIGSTY 0.23.0
PIGSTY 0.23.0
PIGSTY 0.23.0
MISS
Package Version OS ORG SIZE File URL
pg_search_18 0.23.0 el8.x86_64 pigsty 61.6 MiB pg_search_18-0.23.0-1PIGSTY.el8.x86_64.rpm
pg_search_18 0.23.1 el8.aarch64 pigsty 76.1 MiB pg_search_18-0.23.1-1PIGSTY.el8.aarch64.rpm
pg_search_18 0.23.1 el9.x86_64 pigsty 62.0 MiB pg_search_18-0.23.1-1PARADEDB.el9.x86_64.rpm
pg_search_18 0.23.1 el9.aarch64 pigsty 76.0 MiB pg_search_18-0.23.1-1PIGSTY.el9.aarch64.rpm
pg_search_18 0.23.1 el10.x86_64 pigsty 62.0 MiB pg_search_18-0.23.1-1PARADEDB.el10.x86_64.rpm
pg_search_18 0.22.6 el10.aarch64 pigsty 61.0 MiB pg_search_18-0.22.6-1PARADEDB.el10.aarch64.rpm
postgresql-18-pg-search 0.23.1 d12.x86_64 pigsty 60.5 MiB postgresql-18-pg-search_0.23.1_amd64.deb
postgresql-18-pg-search 0.23.1 d12.aarch64 pigsty 58.2 MiB postgresql-18-pg-search_0.23.1_arm64.deb
postgresql-18-pg-search 0.23.1 d13.x86_64 pigsty 60.5 MiB postgresql-18-pg-search_0.23.1_amd64.deb
postgresql-18-pg-search 0.23.1 d13.aarch64 pigsty 58.2 MiB postgresql-18-pg-search_0.23.1_arm64.deb
postgresql-18-pg-search 0.23.1 u22.x86_64 pigsty 60.5 MiB postgresql-18-pg-search_0.23.1_amd64.deb
postgresql-18-pg-search 0.23.1 u22.aarch64 pigsty 58.2 MiB postgresql-18-pg-search_0.23.1_arm64.deb
postgresql-18-pg-search 0.23.1 u24.x86_64 pigsty 60.5 MiB postgresql-18-pg-search_0.23.1_amd64.deb
postgresql-18-pg-search 0.23.1 u24.aarch64 pigsty 58.2 MiB postgresql-18-pg-search_0.23.1_arm64.deb
postgresql-18-pg-search 0.23.0 u26.x86_64 pigsty 59.6 MiB postgresql-18-pg-search_0.23.0-1PIGSTY~resolute_amd64.deb
postgresql-18-pg-search 0.23.0 u26.aarch64 pigsty 59.3 MiB postgresql-18-pg-search_0.23.0-1PIGSTY~resolute_arm64.deb

Source

pig build pkg pg_search;		# build deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_search;		# install via package name, for the active PG version

pig install pg_search -v 18;   # install for PG 18
pig install pg_search -v 17;   # install for PG 17
pig install pg_search -v 16;   # install for PG 16
pig install pg_search -v 15;   # install for PG 15

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_search';

Create this extension with:

CREATE EXTENSION pg_search;

Usage

pg_search is ParadeDB’s BM25-based search extension for PostgreSQL. The upstream README says support starts at PostgreSQL 15, and the v0.23.0 self-hosted install docs still require preloading the library before CREATE EXTENSION.

Enable And Create The Extension

shared_preload_libraries = 'pg_search'
CREATE EXTENSION pg_search;

The self-hosted extension docs for v0.23.0 describe prebuilt binaries for Postgres 15+.

Create A BM25 Index

Quickstart examples use the bm25 access method with a unique key field:

CREATE INDEX search_idx ON mock_items
USING bm25 (id, description, category, rating)
WITH (key_field = 'id');

The v0.23.0 release also notes newly tunable BM25 k1 and b parameters per field.

Query Operators And Helpers

The current quickstart uses these query operators:

  • |||: match disjunction, equivalent to term1 OR term2.
  • &&&: match conjunction, equivalent to term1 AND term2.

Examples:

SELECT description, rating
FROM mock_items
WHERE description ||| 'running shoes'
ORDER BY rating
LIMIT 5;

SELECT description, pdb.score(id)
FROM mock_items
WHERE description &&& 'running shoes'
ORDER BY score DESC
LIMIT 5;

SELECT description, pdb.snippet(description), pdb.score(id)
FROM mock_items
WHERE description ||| 'running shoes'
ORDER BY score DESC
LIMIT 5;

Notes

The development README points users to the docs site for installation and usage instead of documenting SQL details inline. The quickstart is therefore the authoritative usage surface for current pg_search syntax, and it reflects the post-0.20 API rather than the older @@@ examples still found in some secondary materials.

Last updated on