Skip to content

Commit f98a123

Browse files
committed
docs: document PGroonga encoding requirement
1 parent c2903c3 commit f98a123

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

CN/modules/ROOT/pages/5.7.adoc

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

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

EN/modules/ROOT/pages/5.7.adoc

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

92+
== Encoding Compatibility
93+
94+
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.
95+
96+
Create a UTF-8 database for workloads that use PGroonga:
97+
98+
[source,sql]
99+
----
100+
CREATE DATABASE search_db
101+
WITH ENCODING 'UTF8'
102+
LC_COLLATE 'C'
103+
LC_CTYPE 'C'
104+
TEMPLATE template0;
105+
----
106+
107+
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.
108+
92109
== Usage
93110
For PGroonga usage, please refer to the https://pgroonga.github.io/tutorial[PGroonga Official Documentation]

0 commit comments

Comments
 (0)