Skip to content

Commit 14f350f

Browse files
committed
docs: document PGroonga encoding requirement
1 parent 0789c79 commit 14f350f

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

CN/modules/ROOT/pages/master/ecosystem_components/pgroonga.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,22 @@ postgres=# select version();
9090
(1 row)
9191
```
9292

93+
== 编码兼容性
94+
95+
PGroonga 依赖 https://groonga.org/docs/reference/api/util_8h.html#c.grn_encoding[Groonga 支持的字符编码],其中不包含 GB18030。因此,在 GB18030 编码的数据库中创建 PGroonga 索引时,索引可能没有生成词元,并导致查询无法返回匹配结果。
96+
97+
使用 PGroonga 的业务应创建 UTF-8 编码的数据库:
98+
99+
[source,sql]
100+
----
101+
CREATE DATABASE search_db
102+
WITH ENCODING 'UTF8'
103+
LC_COLLATE 'C'
104+
LC_CTYPE 'C'
105+
TEMPLATE template0;
106+
----
107+
108+
修改 Groonga 的运行时编码或重建索引不会改变数据库编码。已有数据需要迁移或重新导入 UTF-8 数据库,再创建 PGroonga 索引。
109+
93110
== 使用
94111
关于PGroonga的使用,请参阅 https://pgroonga.github.io/tutorial[PGroonga官方文档]

EN/modules/ROOT/pages/master/ecosystem_components/pgroonga.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,22 @@ postgres=# select version();
8787
(1 row)
8888
```
8989

90+
== Encoding Compatibility
91+
92+
PGroonga relies on https://groonga.org/docs/reference/api/util_8h.html#c.grn_encoding[Groonga's supported encodings], which do not include GB18030. A PGroonga index created in a GB18030-encoded database may therefore contain no tokens and return no matches.
93+
94+
Create a UTF-8 database for workloads that use PGroonga:
95+
96+
[source,sql]
97+
----
98+
CREATE DATABASE search_db
99+
WITH ENCODING 'UTF8'
100+
LC_COLLATE 'C'
101+
LC_CTYPE 'C'
102+
TEMPLATE template0;
103+
----
104+
105+
Changing Groonga's runtime encoding or rebuilding the index does not change the database encoding. Existing data must be migrated or reloaded into a UTF-8 database before creating the PGroonga index.
106+
90107
== Usage
91108
For PGroonga usage, please refer to the https://pgroonga.github.io/tutorial[PGroonga Official Documentation]

0 commit comments

Comments
 (0)