pg_cjk_parser
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_cjk_parser | 0.1.0 | FTS | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2230 | pg_cjk_parser | No | Yes | No | Yes | No | Yes | - |
| Related | zhparser pg_jieba pg_bigm pgroonga pg_tokenizer pg_pinyin icu_ext unaccent pg_xenophile gb18030_2022 |
|---|
PGSTY applies a PG_CONFIG build-selection patch.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.0 | 1817161514 | pg_cjk_parser | - |
| RPM | PIGSTY | 0.1.0 | 1817161514 | pg_cjk_parser_$v | - |
| DEB | PIGSTY | 0.1.0 | 1817161514 | postgresql-$v-pg-cjk-parser | - |
Build
You can build the RPM / DEB packages for pg_cjk_parser using pig build:
Install
You can install pg_cjk_parser directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
pg_cjk_parser is a PostgreSQL full-text-search parser derived from the built-in parser. In a UTF-8 database it keeps the default behavior for non-CJK text while emitting overlapping 2-gram tokens for Chinese, Japanese, and Korean text. The extension installs parser support functions; you create the text-search parser and configuration that use them.
Core Workflow
Use the configuration explicitly in generated tsvector columns and queries, or set it as the session default:
Important Objects
prsd2_cjk_start,prsd2_cjk_nexttoken,prsd2_cjk_end,prsd2_cjk_lextype, andprsd2_cjk_headline: support functions used byCREATE TEXT SEARCH PARSER.cjk_zht2zhs(text): converts mapped Traditional Chinese characters to Simplified Chinese while leaving other characters unchanged.- Parser token type
cjk: emits overlapping CJK bigrams; CJK punctuation is emitted as a unigram.
Version Notes and Caveats
- Version
0.1.0fixes incorrectcjk_zht2zhsscanning across mixed-width UTF-8 characters and corrects handling of four-byte CJK code points. - Upstream supports PostgreSQL 11 through 18 at this release.
- The database must use UTF-8 for CJK bigram behavior. With another encoding, the parser behaves like the PostgreSQL default parser.
- Creating a text-search parser requires elevated privileges. Decide mappings, dictionaries, stop words, and ranking separately; the example configuration defines only the parser.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)