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.22.2 |
FTS
|
AGPL-3.0
|
Rust
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d--
|
No
|
Yes
|
No
|
Yes
|
no
|
no
|
| Relationships | |
|---|---|
| Schemas | paradedb |
| See Also | pgroonga
pgroonga_database
pg_bestmatch
vchord_bm25
pg_bigm
zhparser
pg_tokenizer
pg_trgm
|
PG 17+ does not require dynamic loading
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
0.22.2 |
18
17
16
15
14
|
pg_search |
- |
| RPM | PIGSTY
|
0.22.2 |
18
17
16
15
14
|
pg_search_$v |
- |
| DEB | PIGSTY
|
0.22.2 |
18
17
16
15
14
|
postgresql-$v-pg-search |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.10
|
el8.aarch64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.10
|
el9.x86_64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.10
|
el9.aarch64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.10
|
el10.x86_64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
MISS
|
el10.aarch64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
MISS
|
d12.x86_64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.7
|
d12.aarch64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.7
|
d13.x86_64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.5
|
d13.aarch64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.5
|
u22.x86_64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.7
|
u22.aarch64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.7
|
u24.x86_64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.7
|
u24.aarch64
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.22.2
|
PIGSTY 0.20.7
|
Source
pig build pkg pg_search; # build debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall 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 15Create this extension with:
CREATE EXTENSION pg_search;THIS EXTENSION is built by ParadeDB team and delivered by the PIGSTY repo
Usage
https://docs.paradedb.com/documentation/getting-started/quickstart
CREATE EXTENSION pg_search;
ALTER SYSTEM SET paradedb.pg_search_telemetry TO 'off';
CALL paradedb.create_bm25_test_table(
schema_name => 'public',
table_name => 'mock_items'
);
SELECT description, rating, category FROM mock_items LIMIT 3;
-- Create a BM25 index (key_field must be UNIQUE, one BM25 index per table)
CREATE INDEX search_idx ON mock_items
USING bm25 (id, description, category, rating, in_stock, created_at, metadata, weight_range)
WITH (key_field='id');
-- Full-text search with @@@ operator
SELECT description, rating, category
FROM mock_items
WHERE description @@@ 'keyboard' AND rating > 2
ORDER BY rating
LIMIT 5;
-- BM25 relevance scoring
SELECT description, paradedb.score(id)
FROM mock_items
WHERE description @@@ 'keyboard'
ORDER BY paradedb.score(id) DESC
LIMIT 5;
-- Highlighting matched terms
SELECT description, paradedb.snippet(description), paradedb.score(id)
FROM mock_items
WHERE description @@@ 'keyboard'
ORDER BY paradedb.score(id) DESC
LIMIT 5;
-- Exact phrase search (use double quotes inside single quotes)
SELECT description, rating, category
FROM mock_items
WHERE description @@@ '"metal keyboard"';
-- Configure text fields with tokenizers (e.g., English stemming)
DROP INDEX search_idx;
CREATE INDEX search_idx ON mock_items
USING bm25 (id, (description::pdb.simple('stemmer=english')), category)
WITH (key_field='id');Last updated on