From 2be842f10f5713007c5a6e9ec5ab20c07dcdc258 Mon Sep 17 00:00:00 2001 From: Steven Niu Date: Fri, 4 Sep 2026 18:00:10 +0800 Subject: [PATCH 1/2] support pg_jieba in IvorySQL --- CN/modules/ROOT/nav.adoc | 1 + .../master/ecosystem_components/pg_jieba.adoc | 68 +++++++++++++++++++ EN/modules/ROOT/nav.adoc | 1 + .../master/ecosystem_components/pg_jieba.adoc | 67 ++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 CN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc create mode 100644 EN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc diff --git a/CN/modules/ROOT/nav.adoc b/CN/modules/ROOT/nav.adoc index b62fe4a5..7498e1d6 100644 --- a/CN/modules/ROOT/nav.adoc +++ b/CN/modules/ROOT/nav.adoc @@ -76,6 +76,7 @@ *** xref:master/ecosystem_components/zhparser.adoc[zhparser] *** xref:master/ecosystem_components/pgbackrest.adoc[pgBackRest] *** xref:master/ecosystem_components/set_user.adoc[set_user] +*** xref:master/ecosystem_components/pg_jieba.adoc[pg_jieba] * 监控运维 ** xref:master/getting-started/daily_monitoring.adoc[日常监控] ** xref:master/getting-started/daily_maintenance.adoc[日常维护] diff --git a/CN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc b/CN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc new file mode 100644 index 00000000..71b30a93 --- /dev/null +++ b/CN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc @@ -0,0 +1,68 @@ + +:sectnums: +:sectnumlevels: 5 + += pg_jieba + +== 概述 + +pg_jieba 是PostgreSQL的一个中文分词扩展,基于著名的结巴分词(Jieba)开发。它能够将连续的中文文本切分成有意义的词语序列,为中文全文搜索提供基础支持。 + +== 功能特点 + +* *支持三种分词模式*:精确模式、全模式和搜索引擎模式。 +* *与PostgreSQL/IvorySQL无缝集成* +* *支持自定义词典* +* *支持词性标注* + +== 安装部署 + +=== 编译安装 pg_jieba + +假设IvorySQL已经安装在 ~/ivy_5/inst 目录中。 + +[source,shell] +---- +git clone https://github.com/jaiminpan/pg_jieba.git +cd pg_jieba +git submodule update --init --recursive +mkdir build;cd build +cmake -DCMAKE_PREFIX_PATH=~/ivy_5/inst .. +make; make install +---- + +安装成功后,`pg_jieba.so` 等文件会被放置到 IvorySQL 的安装目录中。 + +=== 创建扩展并验证 + +[source,sql] +---- +CREATE EXTENSION IF NOT EXISTS pg_jieba; +SELECT name, + default_version, + installed_version, + comment + FROM pg_available_extensions + WHERE name = 'pg_jieba'; +---- + +== 使用 + +执行如下sql示例: + +[source,sql] +---- +select * from to_tsquery('jiebacfg', '是拖拉机学院手扶拖拉机专业的。不用多久,我就会升职加薪,当上CEO,走上人生巅峰。'); + to_tsquery +----------------------------------------------------------------------------------------------- +'拖拉机' & '学院' & '手扶拖拉机' & '专业' & '不用' & '多久' & '会' & '升职' & '加薪' & '当上' & 'ceo' & '走上' & '人生' & '巅峰' +(1 row) + +select * from to_tsvector('jiebacfg', '是拖拉机学院手扶拖拉机专业的。不用多久,我就会升职加薪,当上CEO,走上人生巅峰。'); + to_tsvector +----------------------------------------------------------------------------------------------------- +'ceo':18 '不用':8 '专业':5 '人生':21 '会':13 '加薪':15 '升职':14 '多久':9 '学院':3 '巅峰':22 '当上':17 '手扶拖拉机':4 '拖拉机':2 '走上':20 +(1 row) +---- + + diff --git a/EN/modules/ROOT/nav.adoc b/EN/modules/ROOT/nav.adoc index e4221c78..6983cf77 100644 --- a/EN/modules/ROOT/nav.adoc +++ b/EN/modules/ROOT/nav.adoc @@ -76,6 +76,7 @@ *** xref:master/ecosystem_components/zhparser_en.adoc[zhparser] *** xref:master/ecosystem_components/pgbackrest.adoc[pgBackRest] *** xref:master/ecosystem_components/set_user.adoc[set_user] +*** xref:master/ecosystem_components/pg_jieba.adoc[pg_jieba] * Monitor and O&M ** xref:master/getting-started/daily_monitoring.adoc[Monitoring] ** xref:master/getting-started/daily_maintenance.adoc[Maintenance] diff --git a/EN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc b/EN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc new file mode 100644 index 00000000..5c3df871 --- /dev/null +++ b/EN/modules/ROOT/pages/master/ecosystem_components/pg_jieba.adoc @@ -0,0 +1,67 @@ + +:sectnums: +:sectnumlevels: 5 + += pg_jieba + +== Overview + +pg_jieba is a Chinese word segmentation extension for PostgreSQL, developed based on the well-known Jieba (结巴分词) segmentation library. It can split continuous Chinese text into meaningful sequences of words, providing foundational support for Chinese full-text search. + +== Features + +* *Supports three segmentation modes*: precise mode, full mode, and search engine mode. +* *Seamless integration with PostgreSQL/IvorySQL* +* *Supports custom dictionaries* +* *Supports part-of-speech tagging* + +== Installation and Deployment + +=== Building and Installing pg_jieba + +Assume IvorySQL has already been installed in the `~/ivy_5/inst` directory. + +[source,shell] +---- +git clone https://github.com/jaiminpan/pg_jieba.git +cd pg_jieba +git submodule update --init --recursive +mkdir build;cd build +cmake -DCMAKE_PREFIX_PATH=~/ivy_5/inst .. +make; make install +---- + +After a successful installation, files such as `pg_jieba.so` will be placed into IvorySQL's installation directory. + +=== Creating and Verifying the Extension + +[source,sql] +---- +CREATE EXTENSION IF NOT EXISTS pg_jieba; +SELECT name, + default_version, + installed_version, + comment + FROM pg_available_extensions + WHERE name = 'pg_jieba'; +---- + +== Usage + +Run the following SQL example: + +[source,sql] +---- +select * from to_tsquery('jiebacfg', '是拖拉机学院手扶拖拉机专业的。不用多久,我就会升职加薪,当上CEO,走上人生巅峰。'); + to_tsquery +----------------------------------------------------------------------------------------------- +'拖拉机' & '学院' & '手扶拖拉机' & '专业' & '不用' & '多久' & '会' & '升职' & '加薪' & '当上' & 'ceo' & '走上' & '人生' & '巅峰' +(1 row) + +select * from to_tsvector('jiebacfg', '是拖拉机学院手扶拖拉机专业的。不用多久,我就会升职加薪,当上CEO,走上人生巅峰。'); + to_tsvector +----------------------------------------------------------------------------------------------------- +'ceo':18 '不用':8 '专业':5 '人生':21 '会':13 '加薪':15 '升职':14 '多久':9 '学院':3 '巅峰':22 '当上':17 '手扶拖拉机':4 '拖拉机':2 '走上':20 +(1 row) +---- + From 53133727a5e2e4d3005574ecb4b14be4a328b4cb Mon Sep 17 00:00:00 2001 From: Steven Niu Date: Tue, 8 Sep 2026 13:31:54 +0800 Subject: [PATCH 2/2] add pg_jieba content into overview section --- .../pages/master/ecosystem_components/ecosystem_overview.adoc | 1 + .../pages/master/ecosystem_components/ecosystem_overview.adoc | 1 + 2 files changed, 2 insertions(+) diff --git a/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc b/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc index 074ce67c..4fc67305 100644 --- a/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc +++ b/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc @@ -41,6 +41,7 @@ IvorySQL 作为一款兼容 Oracle 且基于 PostgreSQL 的高级开源数据库 | 28 | xref:master/ecosystem_components/zhparser.adoc[zhparser] | master branch | 用于中文全文搜索的PostgreSQL插件,基于SCWS(即:简易中文分词系统)实现了一个中文解析器 | 搜索引擎、关键字提取 | 29 | xref:master/ecosystem_components/pgbackrest.adoc[pgBackRest] | 2.58.0 | 可靠的 PostgreSQL 备份和恢复解决方案 | 容灾备份、大库备份、异地/多层容灾 | 30 | xref:master/ecosystem_components/set_user.adoc[set_user] | REL4_2_0 | PostgreSQL 安全审计扩展,可控角色切换,支持白名单、强制审计、拦截高危操作 | 可控角色切换、权限管理、审计日志 +| 31 | xref:master/ecosystem_components/pg_jieba.adoc[pg_jieba] | master branch | 中文分词扩展,能够将连续的中文文本切分成有意义的词语序列,为中文全文搜索提供基础支持 | 全文搜索、自然语言处理 |==== 这些插件均经过 IvorySQL 团队的测试和适配,确保在 IvorySQL 环境下稳定运行。用户可以根据业务需求选择合适的插件,进一步提升数据库系统的能力和灵活性。 diff --git a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc index 4e3270c9..6a59432d 100644 --- a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc +++ b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc @@ -42,6 +42,7 @@ IvorySQL, as an advanced open-source database compatible with Oracle and based o |*28*| xref:master/ecosystem_components/zhparser_en.adoc[zhparser] | master branch | PostgreSQL extension for full-text search of Chinese language (Mandarin Chinese). It implements a Chinese language parser base on the | Search engine、keyword extraction |*29*| xref:master/ecosystem_components/pgbackrest.adoc[pgBackRest] | 2.58.0 | pgBackRest is a reliable backup and restore solution for PostgreSQL that seamlessly scales up to the largest databases and workloads | Disaster recovery backup, large database backup, off-site/multi-tier disaster recovery | *30* | xref:master/ecosystem_components/set_user.adoc[set_user] | REL4_2_0 | PostgreSQL security auditing extension with controlled role switching, supporting allowlists, enforced auditing, and blocking of high-risk operations | Controlled role switching, privilege management, audit logging +| *31* | xref:master/ecosystem_components/pg_jieba.adoc[pg_jieba] | master branch | Chinese word segmentation extension, which segments continuous Chinese text into meaningful word sequences, providing fundamental support for full-text search | Full-text search and natural language processing (NLP) |==== These plugins have all been tested and adapted by the IvorySQL team to ensure stable operation in the IvorySQL environment. Users can select appropriate plugins based on business needs to further enhance the capabilities and flexibility of the database system.