Skip to content

pg_kazsearch

Kazakh full-text search extension for PostgreSQL

pg_kazsearch · Kazakh full-text search extension for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2210pg_kazsearchpg_kazsearch2.3.0FTSLGPL-3.0Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY2.3.019 18 17 16 15pg_kazsearch-
RPMPIGSTY2.3.019 18 17 16 15pg_kazsearch_$v-
DEBPIGSTY2.3.019 18 17 16 15postgresql-$v-pg-kazsearch-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
el8.aarch64N/APIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
el9.x86_64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
el9.aarch64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
el10.x86_64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
el10.aarch64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
d12.x86_64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
d12.aarch64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
d13.x86_64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
d13.aarch64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
u22.x86_64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
u22.aarch64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
u24.x86_64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
u24.aarch64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
u26.x86_64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
u26.aarch64PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0PIGSTY 2.3.0N/A
PackageVersionOSORGSIZEFile URL
pg_kazsearch_192.3.0el9.x86_64pigsty1.1 MiBpg_kazsearch_19-2.3.0-2PGSTY.el9.x86_64.rpm
pg_kazsearch_192.3.0el9.aarch64pigsty1.1 MiBpg_kazsearch_19-2.3.0-2PGSTY.el9.aarch64.rpm
pg_kazsearch_192.3.0el10.x86_64pigsty1.1 MiBpg_kazsearch_19-2.3.0-2PGSTY.el10.x86_64.rpm
pg_kazsearch_192.3.0el10.aarch64pigsty1.1 MiBpg_kazsearch_19-2.3.0-2PGSTY.el10.aarch64.rpm
postgresql-19-pg-kazsearch2.3.0d12.x86_64pigsty764.3 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~bookworm_amd64.deb
postgresql-19-pg-kazsearch2.3.0d12.aarch64pigsty686.5 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~bookworm_arm64.deb
postgresql-19-pg-kazsearch2.3.0d13.x86_64pigsty764.7 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~trixie_amd64.deb
postgresql-19-pg-kazsearch2.3.0d13.aarch64pigsty687.8 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~trixie_arm64.deb
postgresql-19-pg-kazsearch2.3.0u22.x86_64pigsty854.5 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~jammy_amd64.deb
postgresql-19-pg-kazsearch2.3.0u22.aarch64pigsty808.7 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~jammy_arm64.deb
postgresql-19-pg-kazsearch2.3.0u24.x86_64pigsty847.6 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~noble_amd64.deb
postgresql-19-pg-kazsearch2.3.0u24.aarch64pigsty796.8 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~noble_arm64.deb
postgresql-19-pg-kazsearch2.3.0u26.x86_64pigsty839.0 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~resolute_amd64.deb
postgresql-19-pg-kazsearch2.3.0u26.aarch64pigsty794.9 KiBpostgresql-19-pg-kazsearch_2.3.0-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_kazsearch_182.3.0el8.x86_64pigsty1.1 MiBpg_kazsearch_18-2.3.0-1PIGSTY.el8.x86_64.rpm
pg_kazsearch_182.3.0el8.aarch64pigsty1016.2 KiBpg_kazsearch_18-2.3.0-1PIGSTY.el8.aarch64.rpm
pg_kazsearch_182.3.0el9.x86_64pigsty1.1 MiBpg_kazsearch_18-2.3.0-2PGSTY.el9.x86_64.rpm
pg_kazsearch_182.3.0el9.aarch64pigsty1.1 MiBpg_kazsearch_18-2.3.0-2PGSTY.el9.aarch64.rpm
pg_kazsearch_182.3.0el10.x86_64pigsty1.1 MiBpg_kazsearch_18-2.3.0-2PGSTY.el10.x86_64.rpm
pg_kazsearch_182.3.0el10.aarch64pigsty1.1 MiBpg_kazsearch_18-2.3.0-2PGSTY.el10.aarch64.rpm
postgresql-18-pg-kazsearch2.3.0d12.x86_64pigsty762.7 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~bookworm_amd64.deb
postgresql-18-pg-kazsearch2.3.0d12.aarch64pigsty683.4 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~bookworm_arm64.deb
postgresql-18-pg-kazsearch2.3.0d13.x86_64pigsty763.7 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~trixie_amd64.deb
postgresql-18-pg-kazsearch2.3.0d13.aarch64pigsty685.6 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~trixie_arm64.deb
postgresql-18-pg-kazsearch2.3.0u22.x86_64pigsty851.4 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~jammy_amd64.deb
postgresql-18-pg-kazsearch2.3.0u22.aarch64pigsty804.9 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~jammy_arm64.deb
postgresql-18-pg-kazsearch2.3.0u24.x86_64pigsty845.7 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~noble_amd64.deb
postgresql-18-pg-kazsearch2.3.0u24.aarch64pigsty793.8 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~noble_arm64.deb
postgresql-18-pg-kazsearch2.3.0u26.x86_64pigsty837.4 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~resolute_amd64.deb
postgresql-18-pg-kazsearch2.3.0u26.aarch64pigsty790.6 KiBpostgresql-18-pg-kazsearch_2.3.0-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_kazsearch_172.3.0el8.x86_64pigsty1.1 MiBpg_kazsearch_17-2.3.0-1PIGSTY.el8.x86_64.rpm
pg_kazsearch_172.3.0el8.aarch64pigsty1013.8 KiBpg_kazsearch_17-2.3.0-1PIGSTY.el8.aarch64.rpm
pg_kazsearch_172.3.0el9.x86_64pigsty1.1 MiBpg_kazsearch_17-2.3.0-2PGSTY.el9.x86_64.rpm
pg_kazsearch_172.3.0el9.aarch64pigsty1.1 MiBpg_kazsearch_17-2.3.0-2PGSTY.el9.aarch64.rpm
pg_kazsearch_172.3.0el10.x86_64pigsty1.1 MiBpg_kazsearch_17-2.3.0-2PGSTY.el10.x86_64.rpm
pg_kazsearch_172.3.0el10.aarch64pigsty1.1 MiBpg_kazsearch_17-2.3.0-2PGSTY.el10.aarch64.rpm
postgresql-17-pg-kazsearch2.3.0d12.x86_64pigsty759.3 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~bookworm_amd64.deb
postgresql-17-pg-kazsearch2.3.0d12.aarch64pigsty682.8 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~bookworm_arm64.deb
postgresql-17-pg-kazsearch2.3.0d13.x86_64pigsty759.3 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~trixie_amd64.deb
postgresql-17-pg-kazsearch2.3.0d13.aarch64pigsty683.3 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~trixie_arm64.deb
postgresql-17-pg-kazsearch2.3.0u22.x86_64pigsty847.5 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~jammy_amd64.deb
postgresql-17-pg-kazsearch2.3.0u22.aarch64pigsty803.6 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~jammy_arm64.deb
postgresql-17-pg-kazsearch2.3.0u24.x86_64pigsty844.6 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~noble_amd64.deb
postgresql-17-pg-kazsearch2.3.0u24.aarch64pigsty791.2 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~noble_arm64.deb
postgresql-17-pg-kazsearch2.3.0u26.x86_64pigsty832.4 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~resolute_amd64.deb
postgresql-17-pg-kazsearch2.3.0u26.aarch64pigsty787.6 KiBpostgresql-17-pg-kazsearch_2.3.0-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_kazsearch_162.3.0el8.x86_64pigsty1.1 MiBpg_kazsearch_16-2.3.0-1PIGSTY.el8.x86_64.rpm
pg_kazsearch_162.3.0el8.aarch64pigsty1012.5 KiBpg_kazsearch_16-2.3.0-1PIGSTY.el8.aarch64.rpm
pg_kazsearch_162.3.0el9.x86_64pigsty1.1 MiBpg_kazsearch_16-2.3.0-2PGSTY.el9.x86_64.rpm
pg_kazsearch_162.3.0el9.aarch64pigsty1.1 MiBpg_kazsearch_16-2.3.0-2PGSTY.el9.aarch64.rpm
pg_kazsearch_162.3.0el10.x86_64pigsty1.1 MiBpg_kazsearch_16-2.3.0-2PGSTY.el10.x86_64.rpm
pg_kazsearch_162.3.0el10.aarch64pigsty1.1 MiBpg_kazsearch_16-2.3.0-2PGSTY.el10.aarch64.rpm
postgresql-16-pg-kazsearch2.3.0d12.x86_64pigsty758.1 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~bookworm_amd64.deb
postgresql-16-pg-kazsearch2.3.0d12.aarch64pigsty682.6 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~bookworm_arm64.deb
postgresql-16-pg-kazsearch2.3.0d13.x86_64pigsty758.9 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~trixie_amd64.deb
postgresql-16-pg-kazsearch2.3.0d13.aarch64pigsty682.1 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~trixie_arm64.deb
postgresql-16-pg-kazsearch2.3.0u22.x86_64pigsty847.0 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~jammy_amd64.deb
postgresql-16-pg-kazsearch2.3.0u22.aarch64pigsty802.7 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~jammy_arm64.deb
postgresql-16-pg-kazsearch2.3.0u24.x86_64pigsty844.0 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~noble_amd64.deb
postgresql-16-pg-kazsearch2.3.0u24.aarch64pigsty790.2 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~noble_arm64.deb
postgresql-16-pg-kazsearch2.3.0u26.x86_64pigsty830.6 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~resolute_amd64.deb
postgresql-16-pg-kazsearch2.3.0u26.aarch64pigsty787.2 KiBpostgresql-16-pg-kazsearch_2.3.0-2PGSTY~resolute_arm64.deb

Source

pig build pkg pg_kazsearch;		# build rpm/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_kazsearch;		# install by package name

pig install pg_kazsearch -v 19;   # install for PG 19
pig install pg_kazsearch -v 18;   # install for PG 18
pig install pg_kazsearch -v 17;   # install for PG 17
pig install pg_kazsearch -v 16;   # install for PG 16

Create this extension with:

CREATE EXTENSION pg_kazsearch;

Usage

Sources:

pg_kazsearch provides Kazakh full-text stemming for PostgreSQL 16 through 18. It installs a ready-to-use kazakh_cfg configuration and pg_kazsearch_dict dictionary. Cyrillic and supported modern Latin-script Kazakh converge to canonical Cyrillic stems so documents and queries can match across scripts.

Core Workflow

CREATE EXTENSION pg_kazsearch;

SELECT ts_lexize('pg_kazsearch_dict', 'алмаларымыздағы');
-- {алма}

SELECT to_tsvector('kazakh_cfg', 'мектептеріміздегі оқушылардың');
-- 'мектеп':1 'оқушы':2

Add a weighted stored vector and GIN index:

ALTER TABLE articles ADD COLUMN fts tsvector
GENERATED ALWAYS AS (
    setweight(to_tsvector('kazakh_cfg', title), 'A') ||
    setweight(to_tsvector('kazakh_cfg', body), 'B')
) STORED;

CREATE INDEX articles_fts_idx ON articles USING GIN (fts);

SELECT title
FROM articles
WHERE fts @@ websearch_to_tsquery('kazakh_cfg', 'президенттің жарлығы')
ORDER BY ts_rank_cd(
    fts,
    websearch_to_tsquery('kazakh_cfg', 'президенттің жарлығы')
) DESC;

Dictionary Tuning

Penalty weights can be changed at runtime:

ALTER TEXT SEARCH DICTIONARY pg_kazsearch_dict
    (w_deriv = 3.5, w_short_char = 100.0);

The default script_mode = auto detects supported modern Kazakh Latin orthography and returns Cyrillic stems. Disable Latin handling when strict Cyrillic-only behavior is required:

ALTER TEXT SEARCH DICTIONARY pg_kazsearch_dict
    (script_mode = cyrillic_only);

Upgrade and Search Caveats

  • Stemmer upgrades change index terms. After upgrading to 2.3.0, recompute stored tsvector columns or repopulate trigger-maintained vectors, then VACUUM (ANALYZE) the table.
ALTER EXTENSION pg_kazsearch UPDATE;
UPDATE articles SET title = title;
VACUUM (ANALYZE) articles;
  • Long-lived sessions opened before an upgrade should reconnect so they load the new dictionary.
  • Latin support targets the modern orthography. Mixed-script input, legacy apostrophe/acute/digraph spellings, and low-confidence ASCII tokens may remain unchanged.
  • websearch_to_tsquery uses strict AND semantics for ordinary terms. Applications that need broader recall should deliberately implement and measure a fallback query rather than silently changing all searches to OR.

Table reader