pg_jieba
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_jieba | 1.1.0 | FTS | BSD-3-Clause | C++ |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2240 | pg_jieba | No | Yes | No | Yes | No | Yes | - |
| Related | pg_cjk_parser pgroonga pg_tokenizer zhparser pg_bigm pg_pinyin pg_tiktoken pg_tiktoken_c unaccent dict_xsyn |
|---|
Package 2.0.1 ships extension version 1.1.0, vendors cppjieba commit 45809955, and fixes the LexDescr terminator allocation.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1.0 | 1817161514 | pg_jieba | - |
| RPM | PIGSTY | 2.0.1 | 1817161514 | pg_jieba_$v | - |
| DEB | PIGSTY | 2.0.1 | 1817161514 | postgresql-$v-pg-jieba | - |
Build
You can build the RPM / DEB packages for pg_jieba using pig build:
Install
You can install pg_jieba 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_jieba adds Jieba-based Chinese word segmentation to PostgreSQL full-text search. The upstream v2.0.1 source release installs SQL extension version 1.1.0, as recorded by its control file. It provides separate document and query parsers plus ready-to-use text-search configurations.
Core Workflow
Use jiebacfg to build searchable document vectors and jiebaqry to segment user queries:
Object Index
jieba: document text-search parser.jiebaqry: query-oriented text-search parser.jiebacfg: document text-search configuration usingjiebaandjieba_stem.jiebaqry: text-search configuration of the same name using the query parser.jieba_stem: simple dictionary with Jieba stop words used for the parser’s token categories.
Custom Dictionary and Caveats
Upstream reads a custom dictionary named jieba.user.dict.utf8 from PostgreSQL’s tsearch_data directory. Entries may contain a word and optional part-of-speech tag:
- The v2.x source requires a C++11-capable compiler because of its bundled
cppjiebadependency. - Upstream’s published compatibility testing is old and limited. Build and regression-test the package against the exact PostgreSQL major version used in production.
- Changing dictionaries changes tokenization. Recompute stored
tsvectorvalues and rebuild dependent indexes when dictionary output changes.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)