Skip to content
pg_kazsearch

pg_kazsearch

pg_kazsearch : Kazakh full-text search extension for PostgreSQL

Overview

ID Extension Package Version Category License Language
2200
pg_kazsearch
pg_kazsearch
2.3.0
FTS
LGPL-3.0
Rust
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d--
No
Yes
No
Yes
no
no

Upstream 2.3.0 uses pgrx 0.17.0; PIGSTY packaging builds with pgrx 0.19.1 for PostgreSQL 16 through 18.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
2.3.0
18
17
16
15
14
pg_kazsearch -
RPM
PIGSTY
2.3.0
18
17
16
15
14
pg_kazsearch_$v -
DEB
PIGSTY
2.3.0
18
17
16
15
14
postgresql-$v-pg-kazsearch -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
el8.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
el9.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
el9.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
el10.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
el10.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
d12.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
d12.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
d13.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
d13.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
u22.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
u22.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
u24.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
u24.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
u26.x86_64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
u26.aarch64
PIGSTY 2.3.0
PIGSTY 2.3.0
PIGSTY 2.3.0
N/A
N/A
Package Version OS ORG SIZE File URL
pg_kazsearch_18 2.3.0 el8.x86_64 pigsty 1.1 MiB pg_kazsearch_18-2.3.0-1PIGSTY.el8.x86_64.rpm
pg_kazsearch_18 2.3.0 el8.aarch64 pigsty 1016.2 KiB pg_kazsearch_18-2.3.0-1PIGSTY.el8.aarch64.rpm
pg_kazsearch_18 2.3.0 el9.x86_64 pigsty 1.1 MiB pg_kazsearch_18-2.3.0-1PIGSTY.el9.x86_64.rpm
pg_kazsearch_18 2.3.0 el9.aarch64 pigsty 1.0 MiB pg_kazsearch_18-2.3.0-1PIGSTY.el9.aarch64.rpm
pg_kazsearch_18 2.3.0 el10.x86_64 pigsty 1.1 MiB pg_kazsearch_18-2.3.0-1PIGSTY.el10.x86_64.rpm
pg_kazsearch_18 2.3.0 el10.aarch64 pigsty 1.0 MiB pg_kazsearch_18-2.3.0-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-kazsearch 2.3.0 d12.x86_64 pigsty 858.1 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-kazsearch 2.3.0 d12.aarch64 pigsty 749.5 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-kazsearch 2.3.0 d13.x86_64 pigsty 858.2 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-kazsearch 2.3.0 d13.aarch64 pigsty 749.5 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-kazsearch 2.3.0 u22.x86_64 pigsty 959.5 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-kazsearch 2.3.0 u22.aarch64 pigsty 883.4 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-kazsearch 2.3.0 u24.x86_64 pigsty 953.6 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~noble_amd64.deb
postgresql-18-pg-kazsearch 2.3.0 u24.aarch64 pigsty 869.6 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~noble_arm64.deb
postgresql-18-pg-kazsearch 2.3.0 u26.x86_64 pigsty 945.3 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~resolute_amd64.deb
postgresql-18-pg-kazsearch 2.3.0 u26.aarch64 pigsty 867.0 KiB postgresql-18-pg-kazsearch_2.3.0-1PIGSTY~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 via package name, for the active PG version

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.
Last updated on