From ccdea0286379011b85c233de1f5f812b37e15f62 Mon Sep 17 00:00:00 2001 From: Oreo Yang <2167young@163.com> Date: Fri, 31 Oct 2025 14:44:37 +0800 Subject: [PATCH 1/5] add pgroonga adapted docs --- CN/modules/ROOT/nav.adoc | 2 +- CN/modules/ROOT/pages/master/5.7.adoc | 94 +++++++++++++++++++++++++++ EN/modules/ROOT/nav.adoc | 2 +- EN/modules/ROOT/pages/master/5.7.adoc | 87 +++++++++++++++++++++++++ 4 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 CN/modules/ROOT/pages/master/5.7.adoc create mode 100644 EN/modules/ROOT/pages/master/5.7.adoc diff --git a/CN/modules/ROOT/nav.adoc b/CN/modules/ROOT/nav.adoc index fb98c26..45d96de 100644 --- a/CN/modules/ROOT/nav.adoc +++ b/CN/modules/ROOT/nav.adoc @@ -19,6 +19,7 @@ *** xref:master/5.4.adoc[pg_cron] *** xref:master/5.5.adoc[pgsql-http] *** xref:master/5.6.adoc[plpgsql_check] +*** xref:master/5.7.adoc[pgroonga] ** IvorySQL架构设计 *** 查询处理 **** xref:master/6.1.1.adoc[双parser] @@ -34,7 +35,6 @@ **** xref:master/6.3.7.adoc[嵌套子函数] **** xref:master/6.3.8.adoc[Force View] **** xref:master/6.3.9.adoc[大小写转换] -*** xref:master/6.4.adoc[国标GB18030] *** 内置函数 **** xref:master/6.4.1.adoc[sys_context] **** xref:master/6.4.2.adoc[userenv] diff --git a/CN/modules/ROOT/pages/master/5.7.adoc b/CN/modules/ROOT/pages/master/5.7.adoc new file mode 100644 index 0000000..1f5dfe6 --- /dev/null +++ b/CN/modules/ROOT/pages/master/5.7.adoc @@ -0,0 +1,94 @@ + +:sectnums: +:sectnumlevels: 5 + += PGroonga + +== 概述 +PostgreSQL 内置了全文搜索功能,但在处理​​大规模数据​​、​​复杂查询​​以及​​非英语语言(特别是中日韩等 CJK 语言)​​ 时,其功能和性能可能无法满足高性能应用的需求。 + +PGroonga 应运而生,它是一个 PostgreSQL 的扩展插件,将 ​​Groonga​​ 这款高性能的全功能全文搜索引擎与 PostgreSQL 数据库深度融合。Groonga 本身是一个优秀的开源搜索引擎,以其极致的速度和丰富的功能著称,尤其擅长处理多语言文本。PGroonga 的使命就是将 Groonga 的强大能力无缝地带入 PostgreSQL 的世界,为用户提供远超原生全文搜索的体验。 + +== 安装 +[NOTE] +IvorySQL的安装包里已经集成了PGroonga插件,如果使用安装包安装的IvorySQL,通常不需要再手动安装PGroonga,直接跳过安装步骤即可。 + +用户可从 https://pgroonga.github.io/install[PGroonga package安装] 页面选择适合自己的方式进行PGroonga安装。 + +IvorySQL社区提供则补充源码安装步骤,以PGroonga v4.0.4为例。 + +=== 安装依赖 + +环境 +``` + 操作系统:Ubuntu 24.04 + CPU架构:x86_64 + IvorySQL: v5.0 +``` + +==== 安装 msgpack-c + +编译PGroonga,有个配置选项:HAVE_MSGPACK=1,它是用于支持WAL,使用这个选项需要安装msgpack-c 1.4.1或者更高版本。 + +``` + sudo apt install libmsgpack-dev +``` +==== 安装 Groonga + +确保Groonga >= 14.0.0 + +``` + sudo apt install groonga libgroonga-dev +``` +验证Groonga安装成功 +```bash +highgo@ubuntu:~/work/IvorySQL/inst$ groonga --version + Groonga 15.1.7 [Linux,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,message-pack,mruby,onigmo,zlib,lz4,zstandard,epoll,apache-arrow,xxhash,blosc,h3,simdjson,llama.cpp] +``` + + +=== 编译安装PGroonga + +==== 下载解压源码 + +```bash + wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.4.tar.gz + tar xvf pgroonga-4.0.4.tar.gz + cd pgroonga-4.0.4 +``` +==== 编译 +运行make前确保`pg_config`命令的路径在`PATH`环境变量里,例如IvorySQL安装的路径是`~/work/IvorySQL/inst`,则环境变量设置如下: + +```bash + export PGHOME=~/work/IvorySQL/inst + export PGDATA=$PGHOME/data + export PATH=$PGHOME/bin:$PATH +``` +然后执行以下命令进行编译和安装: +```bash + make HAVE_MSGPACK=1 + make install +``` + +== 创建Extension并确认PGroonga版本 + + +psql 连接到数据库的pg模式下,执行命令: +```sql +postgres=# CREATE extension pgroonga; +CREATE EXTENSION +postgres=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga'; + name | default_version | installed_version | comment +----------+-----------------+-------------------+-------------------------------------------------------------------------------- + pgroonga | 4.0.4 | 4.0.4 | Super fast and all languages supported full text search index based on Groonga +(1 row) + +postgres=# select version(); + version +-------------------------------------------------------------------------------- + PostgreSQL (IvorySQL 5.0) 18.0 on x86_64-linux, compiled by gcc-13.3.0, 64-bit +(1 row) +``` + +== 使用 +关于PGroonga的使用,请参阅 https://pgroonga.github.io/tutorial[PGroonga官方文档] diff --git a/EN/modules/ROOT/nav.adoc b/EN/modules/ROOT/nav.adoc index 9498183..a4c178d 100644 --- a/EN/modules/ROOT/nav.adoc +++ b/EN/modules/ROOT/nav.adoc @@ -18,6 +18,7 @@ ** xref:master/5.4.adoc[pg_cron] ** xref:master/5.5.adoc[pgsql-http] ** xref:master/5.6.adoc[plpgsql_check] +** xref:master/5.7.adoc[pgroonga] * IvorySQL Architecture Design ** Query Processing *** xref:master/6.1.1.adoc[Dual Parser] @@ -33,7 +34,6 @@ *** xref:master/6.3.7.adoc[Nested Subfunctions] *** xref:master/6.3.8.adoc[Force View] *** xref:master/6.3.9.adoc[Case Conversion] -** xref:master/6.4.adoc[GB18030 Character Set] ** Built-in Functions *** xref:master/6.4.1.adoc[sys_context] *** xref:master/6.4.2.adoc[userenv] diff --git a/EN/modules/ROOT/pages/master/5.7.adoc b/EN/modules/ROOT/pages/master/5.7.adoc new file mode 100644 index 0000000..f886ab6 --- /dev/null +++ b/EN/modules/ROOT/pages/master/5.7.adoc @@ -0,0 +1,87 @@ +:sectnums: +:sectnumlevels: 5 + += PGroonga + +== Overview +PostgreSQL has built-in full-text search functionality, but when dealing with large-scale data, complex queries, and non-English languages (especially CJK languages like Chinese, Japanese, and Korean), its functionality and performance may not meet the requirements of high-performance applications. + +PGroonga was created to address this need. It is a PostgreSQL extension that deeply integrates Groonga, a high-performance full-featured full-text search engine, with the PostgreSQL database. Groonga itself is an excellent open-source search engine, renowned for its extreme speed and rich functionality, particularly excelling at handling multilingual text. PGroonga's mission is to seamlessly bring Groonga's powerful capabilities into the PostgreSQL world, providing users with an experience that far exceeds native full-text search. + +== Installation +[NOTE] +The PGroonga plugin is already included in the IvorySQL installation package. If you installed IvorySQL using the official released package, you typically do not need to manually install PGroonga and can skip the installation steps. + +You can choose their preferred installation method for PGroonga from the https://pgroonga.github.io/install[PGroonga package installation] page. + +The IvorySQL community also provides supplementary source code installation steps, using PGroonga v4.0.4 as an example. + +=== Dependencies + +Setup Environment +``` + Operating System: Ubuntu 24.04 + CPU Architecture: x86_64 + IvorySQL: v5.0 +``` +==== Install msgpack-c + +When compiling PGroonga with `HAVE_MSGPACK=1`, which is used to support WAL. Enabling this option requires installing msgpack-c 1.4.1 or later. +```bash + sudo apt install libmsgpack-dev +``` +==== Install Groonga + +Ensure Groonga >= 14.0.0 is installed. +```bash + sudo apt install groonga libgroonga-dev +``` +Verify Groonga installation: + +```bash +highgo@ubuntu:~/work/IvorySQL/inst$ groonga --version + Groonga 15.1.7 [Linux,x86_64,utf8,match-escalation-threshold=0,nfkc,mecab,message-pack,mruby,onigmo,zlib,lz4,zstandard,epoll,apache-arrow,xxhash,blosc,h3,simdjson,llama.cpp] +``` + +=== Compile and Install PGroonga + +==== Download and Extract the PGroonga Source Code + +```bash + wget https://packages.groonga.org/source/pgroonga/pgroonga-4.0.4.tar.gz + tar xvf pgroonga-4.0.4.tar.gz + cd pgroonga-4.0.4 +``` +==== Compile + +Before running make , ensure that the `pg_config` command is in the `PATH` environment variable. For example, if IvorySQL is installed at `~/work/IvorySQL/inst` , set the environment variables as follows: + +```bash + export PGHOME=~/work/IvorySQL/inst + export PGDATA=$PGHOME/data + export PATH=$PGHOME/bin:$PATH +``` +Then execute the following commands to compile and install: + +```bash + make HAVE_MSGPACK=1 + make install +``` + +== Create Extension PGroonga and Confirm the version + +Connect to the database with `psql` in `pg` mode and execute the following commands: +```sql +postgres=# CREATE extension pgroonga; +CREATE EXTENSION +postgres=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga'; + name | default_version | installed_version | comment +----------+-----------------+-------------------+-------------------------------------------------------------------------------- + pgroonga | 4.0.4 | 4.0.4 | Super fast and all languages supported full text search index based on Groonga +(1 row) + +postgres=# select version(); +``` + +== Usage +For PGroonga usage, please refer to the https://pgroonga.github.io/tutorial[PGroonga Official Documentation] From 8bff1da5c2534c21fa49b3a81625efa4d230bdad Mon Sep 17 00:00:00 2001 From: Oreo Yang <2167young@163.com> Date: Fri, 31 Oct 2025 17:02:35 +0800 Subject: [PATCH 2/5] add pgroonga to the support list in the overview file --- CN/modules/ROOT/pages/master/5.0.adoc | 1 + EN/modules/ROOT/pages/master/5.0.adoc | 1 + 2 files changed, 2 insertions(+) diff --git a/CN/modules/ROOT/pages/master/5.0.adoc b/CN/modules/ROOT/pages/master/5.0.adoc index 6ea7aa1..e687818 100644 --- a/CN/modules/ROOT/pages/master/5.0.adoc +++ b/CN/modules/ROOT/pages/master/5.0.adoc @@ -17,6 +17,7 @@ IvorySQL 作为一款兼容 Oracle 且基于 PostgreSQL 的高级开源数据库 | xref:master/5.4.adoc[pg_cron]​ | 1.6.0 | 提供数据库内部的定时任务调度功能,支持定期执行SQL语句 | 数据清理、定期统计、自动化维护任务 | xref:master/5.5.adoc[pgsql-http]​ | 1.7.0 | 允许在SQL中发起HTTP请求,与外部Web服务进行交互 | 数据采集、API集成、微服务调用 | xref:master/5.6.adoc[plpgsql_check] | 2.8 | 提供PL/pgSQL代码的静态分析功能,可在开发阶段发现潜在错误 | 存储过程开发、代码质量检查、调试优化 +| xref:master/5.7.adoc[pgroonga] | 4.0.4 | 提供​非英语语言全文搜索功能,满足高性能应用的需求 | 中日韩等语言的全文搜索功能 |==== 这些插件均经过 IvorySQL 团队的测试和适配,确保在 IvorySQL 环境下稳定运行。用户可以根据业务需求选择合适的插件,进一步提升数据库系统的能力和灵活性。 diff --git a/EN/modules/ROOT/pages/master/5.0.adoc b/EN/modules/ROOT/pages/master/5.0.adoc index 437b44c..e637546 100644 --- a/EN/modules/ROOT/pages/master/5.0.adoc +++ b/EN/modules/ROOT/pages/master/5.0.adoc @@ -17,6 +17,7 @@ IvorySQL, as an advanced open-source database compatible with Oracle and based o | xref:master/5.4.adoc[pg_cron]​ | 1.6.0 | Provides database-internal scheduled task scheduling functionality, supports regular SQL statement execution | Data cleanup, regular statistics, automated maintenance tasks | xref:master/5.5.adoc[pgsql-http]​ | 1.7.0 | Allows HTTP requests to be initiated in SQL, interacting with external web services | Data collection, API integration, microservice calls | xref:master/5.6.adoc[plpgsql_check] | 2.8 | Provides static analysis functionality for PL/pgSQL code, can detect potential errors during development | Stored procedure development, code quality checking, debugging and optimization +| xref:master/5.7.adoc[pgroonga] | 4.0.4 | Provides full-text search functionality for non-English languages, meeting the needs of high-performance applications | Full-text search capabilities for languages like Chinese, Japanese, and Korean |==== 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. From 6ef89dfc5da81a7c9422d347abaed5e01342dd2f Mon Sep 17 00:00:00 2001 From: Oreo Yang <2167young@163.com> Date: Fri, 31 Oct 2025 17:12:47 +0800 Subject: [PATCH 3/5] fix some tiny display issue --- CN/modules/ROOT/pages/master/6.4.1.adoc | 6 +++--- CN/modules/ROOT/pages/master/6.4.2.adoc | 4 ++-- EN/modules/ROOT/pages/master/6.4.1.adoc | 2 +- EN/modules/ROOT/pages/master/6.4.2.adoc | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CN/modules/ROOT/pages/master/6.4.1.adoc b/CN/modules/ROOT/pages/master/6.4.1.adoc index da7ecb5..3ad622c 100644 --- a/CN/modules/ROOT/pages/master/6.4.1.adoc +++ b/CN/modules/ROOT/pages/master/6.4.1.adoc @@ -5,7 +5,7 @@ = **功能概述** -IvorySQL提供兼容Oracle内置函数`SYS_CONTEXT('namespace', 'parameter' [, length ])`, +IvorySQL提供兼容Oracle内置函数 ```SYS_CONTEXT('namespace', 'parameter' [, length ])``` , 返回当前时刻与给定上下文关联参数的值,可以在SQL和PLSQL语言中使用。 提供以下命名空间: @@ -16,8 +16,8 @@ IvorySQL提供兼容Oracle内置函数`SYS_CONTEXT('namespace', 'parameter' [, l == 实现原理 -SYS_CONTEXT的实现原理是通过动态查询系统表与postgres的内置函数,确保结果的实时性, -使用 SECURITY INVOKER 确保函数以调用者的权限执行,避免权限提升问题。 +`SYS_CONTEXT` 的实现原理是通过动态查询系统表与postgres的内置函数,确保结果的实时性, +使用 `SECURITY INVOKER` 确保函数以调用者的权限执行,避免权限提升问题。 该方法的实现逻辑如下: ```sql CREATE OR REPLACE FUNCTION sys.sys_context(a varchar2, b varchar2) diff --git a/CN/modules/ROOT/pages/master/6.4.2.adoc b/CN/modules/ROOT/pages/master/6.4.2.adoc index ad1ec29..d458b81 100644 --- a/CN/modules/ROOT/pages/master/6.4.2.adoc +++ b/CN/modules/ROOT/pages/master/6.4.2.adoc @@ -5,8 +5,8 @@ = **功能概述** -IvorySQL提供兼容Oracle内置函数`USERENV('parameter')`,用于返回当前会话的相关信息。 -这是一个遗留函数,建议使用 SYS_CONTEXT 函数及其内置的 USERENV 命名空间来获取当前功能。 +IvorySQL提供兼容Oracle内置函数 ```USERENV('parameter')``` ,用于返回当前会话的相关信息。 +这是一个遗留函数,建议使用 `SYS_CONTEXT` 函数及其内置的 `USERENV` 命名空间来获取当前功能。 == 实现原理 diff --git a/EN/modules/ROOT/pages/master/6.4.1.adoc b/EN/modules/ROOT/pages/master/6.4.1.adoc index d2fb4f2..0573360 100644 --- a/EN/modules/ROOT/pages/master/6.4.1.adoc +++ b/EN/modules/ROOT/pages/master/6.4.1.adoc @@ -3,7 +3,7 @@ = **Feature Overview** -IvorySQL provides compatibility with the Oracle built-in function `SYS_CONTEXT('namespace', 'parameter' [, length ])`, +IvorySQL provides compatibility with the Oracle built-in function ```SYS_CONTEXT('namespace', 'parameter' [, length ])```, which returns the value of the parameter associated with the given context at the current moment. It can be used in both SQL and PL/SQL languages. IvorySQL provides the following built-in namespaces: diff --git a/EN/modules/ROOT/pages/master/6.4.2.adoc b/EN/modules/ROOT/pages/master/6.4.2.adoc index 678a5f2..13d98ab 100644 --- a/EN/modules/ROOT/pages/master/6.4.2.adoc +++ b/EN/modules/ROOT/pages/master/6.4.2.adoc @@ -3,7 +3,7 @@ = **Feature Overview** -IvorySQL provides compatibility with Oracle's built-in function `USERENV('parameter')`, which is used to return information about the current session. +IvorySQL provides compatibility with Oracle's built-in function ```USERENV('parameter')```, which is used to return information about the current session. This is a legacy function, and IvorySQL recommends taht you can use the `SYS_CONTEXT` function with its built-in `USERENV` namespace for current functionality. == Implementation Principle From 97845bfdf0e4723e7d30e0f4a490b4749e452208 Mon Sep 17 00:00:00 2001 From: Oreo Yang <2167young@163.com> Date: Tue, 4 Nov 2025 13:07:42 +0800 Subject: [PATCH 4/5] fix review comments --- CN/modules/ROOT/pages/master/5.7.adoc | 2 +- EN/modules/ROOT/pages/master/5.7.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CN/modules/ROOT/pages/master/5.7.adoc b/CN/modules/ROOT/pages/master/5.7.adoc index 1f5dfe6..14727fe 100644 --- a/CN/modules/ROOT/pages/master/5.7.adoc +++ b/CN/modules/ROOT/pages/master/5.7.adoc @@ -15,7 +15,7 @@ IvorySQL的安装包里已经集成了PGroonga插件,如果使用安装包安 用户可从 https://pgroonga.github.io/install[PGroonga package安装] 页面选择适合自己的方式进行PGroonga安装。 -IvorySQL社区提供则补充源码安装步骤,以PGroonga v4.0.4为例。 +IvorySQL社区提供了源码安装步骤,下面以PGroonga v4.0.4为例进行演示。 === 安装依赖 diff --git a/EN/modules/ROOT/pages/master/5.7.adoc b/EN/modules/ROOT/pages/master/5.7.adoc index f886ab6..d2e796e 100644 --- a/EN/modules/ROOT/pages/master/5.7.adoc +++ b/EN/modules/ROOT/pages/master/5.7.adoc @@ -14,7 +14,7 @@ The PGroonga plugin is already included in the IvorySQL installation package. If You can choose their preferred installation method for PGroonga from the https://pgroonga.github.io/install[PGroonga package installation] page. -The IvorySQL community also provides supplementary source code installation steps, using PGroonga v4.0.4 as an example. +The IvorySQL community provides source code installation steps, demonstrated below using PGroonga v4.0.4 as an example. === Dependencies From c882f07a40c75a7b78562f38e304bae25bd47cce Mon Sep 17 00:00:00 2001 From: Oreo Yang <2167young@163.com> Date: Tue, 4 Nov 2025 13:58:58 +0800 Subject: [PATCH 5/5] fix review comments --- EN/modules/ROOT/pages/master/5.7.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/EN/modules/ROOT/pages/master/5.7.adoc b/EN/modules/ROOT/pages/master/5.7.adoc index d2e796e..987f324 100644 --- a/EN/modules/ROOT/pages/master/5.7.adoc +++ b/EN/modules/ROOT/pages/master/5.7.adoc @@ -26,7 +26,7 @@ Setup Environment ``` ==== Install msgpack-c -When compiling PGroonga with `HAVE_MSGPACK=1`, which is used to support WAL. Enabling this option requires installing msgpack-c 1.4.1 or later. +When compile PGroonga, there is an option: `HAVE_MSGPACK=1`, which is used to support WAL. Enabling this option requires installing msgpack-c 1.4.1 or newer version. ```bash sudo apt install libmsgpack-dev ``` @@ -81,6 +81,10 @@ postgres=# SELECT * FROM pg_available_extensions WHERE name = 'pgroonga'; (1 row) postgres=# select version(); + version +-------------------------------------------------------------------------------- + PostgreSQL (IvorySQL 5.0) 18.0 on x86_64-linux, compiled by gcc-13.3.0, 64-bit +(1 row) ``` == Usage