pg_search

pg_search

Full text search for PostgreSQL using BM25

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2100
pg_search
pg_search
0.19.3
FTS
AGPL-3.0
Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-dt-
No
Yes
No
Yes
no
yes
Relationships
See Also
pgroonga
pgroonga_database
pg_bestmatch
vchord_bm25
pg_bigm
zhparser
pg_tokenizer
pg_trgm

PG 17+ does not require dynamic loading, build by ParadeDB team

Packages

TypeRepoVersionPG Major AvailabilityPackage PatternDependencies
EL
PIGSTY
0.19.2
18
17
16
15
14
13
pg_search_$v-
Debian
PIGSTY
0.19.2
18
17
16
15
14
13
postgresql-$v-pg-search-
Linux / PGPG18PG17PG16PG15PG14PG13
el8.x86_64
MISS
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
MISS
el8.aarch64
MISS
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
MISS
el9.x86_64
MISS
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
MISS
el9.aarch64
MISS
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
PIGSTY 0.19.3
MISS
el10.x86_64
MISS
MISS
MISS
MISS
MISS
MISS
el10.aarch64
MISS
MISS
MISS
MISS
MISS
MISS
d12.x86_64
MISS
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
MISS
d12.aarch64
MISS
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
MISS
d13.x86_64
MISS
MISS
MISS
MISS
MISS
MISS
d13.aarch64
MISS
MISS
MISS
MISS
MISS
MISS
u22.x86_64
MISS
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
MISS
u22.aarch64
MISS
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
MISS
u24.x86_64
MISS
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
MISS
u24.aarch64
MISS
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
PIGSTY 0.19.4
MISS
PackageVersionOSORGSIZEFile URL
pg_search_170.19.3el8.x86_64pigsty46.1 MiBpg_search_17-0.19.3-1PARADEDB.el8.x86_64.rpm
pg_search_170.19.3el8.aarch64pigsty45.5 MiBpg_search_17-0.19.3-1PARADEDB.el8.aarch64.rpm
pg_search_170.19.3el9.x86_64pigsty45.9 MiBpg_search_17-0.19.3-1PARADEDB.el9.x86_64.rpm
pg_search_170.19.3el9.aarch64pigsty45.8 MiBpg_search_17-0.19.3-1PARADEDB.el9.aarch64.rpm
postgresql-17-pg-search0.19.4d12.x86_64pigsty45.4 MiBpostgresql-17-pg-search_0.19.4_amd64.deb
postgresql-17-pg-search0.19.4d12.aarch64pigsty44.9 MiBpostgresql-17-pg-search_0.19.4_arm64.deb
postgresql-17-pg-search0.19.4u22.x86_64pigsty45.4 MiBpostgresql-17-pg-search_0.19.4_amd64.deb
postgresql-17-pg-search0.19.4u22.aarch64pigsty44.9 MiBpostgresql-17-pg-search_0.19.4_arm64.deb
postgresql-17-pg-search0.19.4u24.x86_64pigsty45.4 MiBpostgresql-17-pg-search_0.19.4_amd64.deb
postgresql-17-pg-search0.19.4u24.aarch64pigsty44.9 MiBpostgresql-17-pg-search_0.19.4_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_search_160.19.3el8.x86_64pigsty46.1 MiBpg_search_16-0.19.3-1PARADEDB.el8.x86_64.rpm
pg_search_160.19.3el8.aarch64pigsty45.5 MiBpg_search_16-0.19.3-1PARADEDB.el8.aarch64.rpm
pg_search_160.19.3el9.x86_64pigsty45.9 MiBpg_search_16-0.19.3-1PARADEDB.el9.x86_64.rpm
pg_search_160.19.3el9.aarch64pigsty45.8 MiBpg_search_16-0.19.3-1PARADEDB.el9.aarch64.rpm
postgresql-16-pg-search0.19.4d12.x86_64pigsty45.4 MiBpostgresql-16-pg-search_0.19.4_amd64.deb
postgresql-16-pg-search0.19.4d12.aarch64pigsty44.9 MiBpostgresql-16-pg-search_0.19.4_arm64.deb
postgresql-16-pg-search0.19.4u22.x86_64pigsty45.4 MiBpostgresql-16-pg-search_0.19.4_amd64.deb
postgresql-16-pg-search0.19.4u22.aarch64pigsty44.9 MiBpostgresql-16-pg-search_0.19.4_arm64.deb
postgresql-16-pg-search0.19.4u24.x86_64pigsty45.4 MiBpostgresql-16-pg-search_0.19.4_amd64.deb
postgresql-16-pg-search0.19.4u24.aarch64pigsty44.9 MiBpostgresql-16-pg-search_0.19.4_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_search_150.19.3el8.x86_64pigsty46.1 MiBpg_search_15-0.19.3-1PARADEDB.el8.x86_64.rpm
pg_search_150.19.3el8.aarch64pigsty45.5 MiBpg_search_15-0.19.3-1PARADEDB.el8.aarch64.rpm
pg_search_150.19.3el9.x86_64pigsty45.9 MiBpg_search_15-0.19.3-1PARADEDB.el9.x86_64.rpm
pg_search_150.19.3el9.aarch64pigsty45.8 MiBpg_search_15-0.19.3-1PARADEDB.el9.aarch64.rpm
postgresql-15-pg-search0.19.4d12.x86_64pigsty45.4 MiBpostgresql-15-pg-search_0.19.4_amd64.deb
postgresql-15-pg-search0.19.4d12.aarch64pigsty44.8 MiBpostgresql-15-pg-search_0.19.4_arm64.deb
postgresql-15-pg-search0.19.4u22.x86_64pigsty45.4 MiBpostgresql-15-pg-search_0.19.4_amd64.deb
postgresql-15-pg-search0.19.4u22.aarch64pigsty44.8 MiBpostgresql-15-pg-search_0.19.4_arm64.deb
postgresql-15-pg-search0.19.4u24.x86_64pigsty45.4 MiBpostgresql-15-pg-search_0.19.4_amd64.deb
postgresql-15-pg-search0.19.4u24.aarch64pigsty44.8 MiBpostgresql-15-pg-search_0.19.4_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_search_140.19.3el8.x86_64pigsty46.1 MiBpg_search_14-0.19.3-1PARADEDB.el8.x86_64.rpm
pg_search_140.19.3el8.aarch64pigsty45.5 MiBpg_search_14-0.19.3-1PARADEDB.el8.aarch64.rpm
pg_search_140.19.3el9.x86_64pigsty45.9 MiBpg_search_14-0.19.3-1PARADEDB.el9.x86_64.rpm
pg_search_140.19.3el9.aarch64pigsty45.8 MiBpg_search_14-0.19.3-1PARADEDB.el9.aarch64.rpm
postgresql-14-pg-search0.19.4d12.x86_64pigsty45.4 MiBpostgresql-14-pg-search_0.19.4_amd64.deb
postgresql-14-pg-search0.19.4d12.aarch64pigsty44.9 MiBpostgresql-14-pg-search_0.19.4_arm64.deb
postgresql-14-pg-search0.19.4u22.x86_64pigsty45.4 MiBpostgresql-14-pg-search_0.19.4_amd64.deb
postgresql-14-pg-search0.19.4u22.aarch64pigsty44.8 MiBpostgresql-14-pg-search_0.19.4_arm64.deb
postgresql-14-pg-search0.19.4u24.x86_64pigsty45.4 MiBpostgresql-14-pg-search_0.19.4_amd64.deb
postgresql-14-pg-search0.19.4u24.aarch64pigsty44.8 MiBpostgresql-14-pg-search_0.19.4_arm64.deb

Source

Install

To add the required PGDG / PIGSTY upstream repository, use:

pig repo add pgsql -u   # add PGDG + Pigsty repo and update cache (leave existing repos)

Install this extension with:

pig ext install pg_search; # install by extension name, for the current active PG version
pig ext install pg_search; # install via package alias, for the active PG version
pig ext install pg_search -v 17;   # install for PG 17
pig ext install pg_search -v 16;   # install for PG 16
pig ext install pg_search -v 15;   # install for PG 15
pig ext install pg_search -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION pg_search CASCADE SCHEMA paradedb;

Caveat

pg_search 0.15.19+ RPMs are broken due to libicu version issue

The version is locked to 0.15.18 on EL platforms until the issue is resolved.


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;

CALL paradedb.create_bm25(
        index_name => 'search_idx',
        schema_name => 'public',
        table_name => 'mock_items',
        key_field => 'id',
        text_fields => paradedb.field('description', tokenizer => paradedb.tokenizer('en_stem')) ||
                       paradedb.field('category'),
        numeric_fields => paradedb.field('rating')
     );

SELECT description, rating, category
FROM search_idx.search('(description:keyboard OR category:electronics) AND rating:>2',limit_rows => 5);

CALL paradedb.create_bm25(
        index_name => 'ngrams_idx',
        schema_name => 'public',
        table_name => 'mock_items',
        key_field => 'id',
        text_fields => paradedb.field('description', tokenizer => paradedb.tokenizer('ngram', min_gram => 4, max_gram => 4, prefix_only => false)) ||
                       paradedb.field('category')
     );

SELECT description, rating, category
FROM ngrams_idx.search('description:blue');
Last updated on