diff --git a/dir.yaml b/dir.yaml index c7a11310..4d0be4c7 100644 --- a/dir.yaml +++ b/dir.yaml @@ -448,6 +448,9 @@ - title_en: Query Configuration title_cn: 查询配置 path: admin/configuration-fields/query + - title_en: Index Configuration + title_cn: 索引配置 + path: admin/configuration-fields/index - title_en: Scheduler Configuration title_cn: 调度器配置 path: admin/configuration-fields/scheduler diff --git a/en_US/admin/configuration-fields/index.md b/en_US/admin/configuration-fields/index.md new file mode 100644 index 00000000..2449672a --- /dev/null +++ b/en_US/admin/configuration-fields/index.md @@ -0,0 +1,24 @@ +# Index Configuration + +The `index` section manages the parameters using in index. + +## Sample + +```toml +# The configurations of index. +[index] + +# The configurations for tantivy engine. +[index.tantivy] +# Limit of memory budget when building index. +# Default: "100MB". +build_memory = "100MB" + +# The cache of index is a hybrid cache. +[index.cache] +# Capacity for memory cache. +# Setting to 0 will disable memory cache. +# Default: "0MB" +memory = "10GB" + +``` diff --git a/zh_CN/admin/configuration-fields/index.md b/zh_CN/admin/configuration-fields/index.md new file mode 100644 index 00000000..53938d18 --- /dev/null +++ b/zh_CN/admin/configuration-fields/index.md @@ -0,0 +1,29 @@ +--- +title: "索引配置" +description: "Datalayers 索引配置说明:介绍索引相关的配置方式。" +--- +# 索引配置 + +`index` 部分管理 Datalayers 的索引参数。 + +## 配置示例 + +```toml +# The configurations of index. +[index] + +# 使用 tantivy 引擎时的配置项 +[index.tantivy] +# 使用 tantivy 建索引时的内存容量限制,限定只会使用单线程,所以这就是单线程的内容使用量。 +# 建议不小于 100MB。 +# Default: "100MB". +build_memory = "100MB" + +# 索引查询过程使用的缓存配置 +[index.cache] +# 内存缓存容量 +# 设置为 0 表示关闭内存缓存。 +# Default: "0MB" +memory = "10GB" + +``` diff --git a/zh_CN/admin/datalayers-configuration.md b/zh_CN/admin/datalayers-configuration.md index 469fc65f..03dc3ff1 100644 --- a/zh_CN/admin/datalayers-configuration.md +++ b/zh_CN/admin/datalayers-configuration.md @@ -44,6 +44,12 @@ Datalayers 配置文件为 `datalayers.toml`,根据安装方式其所在位置 # The root directory of all local data storage paths base_dir = "/var/lib/datalayers" +# 存储某些计算中间过程产生的临时文件的目录。 +# 配置相对路径就是相对于 `base_dir` 的路径,也可以配置绝对路径。 +# 不配置会默认使用操作系统的临时目录。 +# Default: None. +temp_dir = "temp" + # The configurations of Datalayers server. [server] # In which mode to start the Datalayers server. diff --git a/zh_CN/admin/system-metrics.md b/zh_CN/admin/system-metrics.md index db0480f2..9a465132 100644 --- a/zh_CN/admin/system-metrics.md +++ b/zh_CN/admin/system-metrics.md @@ -73,6 +73,12 @@ Datalayers 原生支持与 Prometheus 集成,实现高效的监控数据采集 | datalayers_network_rx_packets_total | gauge | 网卡接收的总报文数 | | datalayers_network_tx_packets_total | gauge | 网卡发送的总报文数 | | datalayers_license_valid_days | gauge | 许可证剩余有效时间,单位:天 | +| latency_build_tantivy_per_mb_ms | histogram | 使用 tantivy 引擎创建全文索引每 10M 数据的用时 | +| ratio_build_tantivy_inflate | histogram | 使用 tantivy 引擎创建全文索引文件大小相对比数据的膨胀率,单位:百分比 | +| query_full_text_total | counter | 使用全文检索查询的请求次数 | +| query_tantivy_warmup_size | histogram | 使用 tantivy 引擎查询单个索引文件产生的预热内存大小分布 | +| latency_query_full_text_ms | histogram | 使用全文检索查询的耗时分布,统计单次 sql 查询的耗时 | +| latency_query_tantivy_ms | histogram | 使用 tantivy 引擎查询单个索引文件的耗时分布 | ## FDB Metrics diff --git a/zh_CN/fulltext-search/overview.md b/zh_CN/fulltext-search/overview.md index eaa461a8..4d617203 100644 --- a/zh_CN/fulltext-search/overview.md +++ b/zh_CN/fulltext-search/overview.md @@ -21,7 +21,7 @@ description: "介绍 Datalayers 基于倒排索引的全文检索能力,包括 - 支持 `QUERY`:适合短语检索、布尔表达式和更复杂的查询条件 - 支持 `SCORE()`:返回命中结果的相关性评分,用于排序 - 支持在 `STRING` 列上创建 `INVERTED INDEX` 以加速全文检索 -- 支持通过 `tokenizer`、`filters`、`with_position` 配置索引行为 +- 支持通过 `indexer`、`tokenizer`、`filters`、`with_position` 配置索引行为 ## 如何选择 MATCH 与 QUERY diff --git a/zh_CN/fulltext-search/quick-start.md b/zh_CN/fulltext-search/quick-start.md index d3015a0c..66c7efdb 100644 --- a/zh_CN/fulltext-search/quick-start.md +++ b/zh_CN/fulltext-search/quick-start.md @@ -29,11 +29,12 @@ PARTITION BY HASH(service) PARTITIONS 1; ```sql CREATE INVERTED INDEX idx_message ON logs (message) -WITH (tokenizer='standard', filters='lowercase,english_stop', with_position='true'); +WITH (indexer='tantivy', tokenizer='standard', filters='lowercase,english_stop', with_position='true'); ``` 索引参数说明: +- `indexer='tantivy'`: 采用 tantivy 作为检索引擎, - `tokenizer='standard'`:适合英文文本,按空格和标点进行分词 - `filters='lowercase,english_stop'`:统一大小写并过滤常见英文停用词 - `with_position='true'`:保存词位置信息,便于短语检索和更准确的相关性排序 diff --git a/zh_CN/sql-reference/statements/create.md b/zh_CN/sql-reference/statements/create.md index 363138dc..7261d721 100644 --- a/zh_CN/sql-reference/statements/create.md +++ b/zh_CN/sql-reference/statements/create.md @@ -280,6 +280,7 @@ ON [database.]table_name (column_name) 选项 +- `indexer`: 倒排索引引擎,`tantivy | native`,默认 `tantivy` - `tokenizer`:分词器,`standard | chinese`,默认 `standard` - `with_position`:是否保存词位置信息,`true | false`,默认 `false` - `filters`:过滤器列表,使用 `,` 分隔,默认 `lowercase,english_stop` @@ -306,6 +307,9 @@ WITH (tokenizer='chinese', filters='lowercase,english_stop', with_position='true CREATE INVERTED INDEX idx_message_std ON logs (message) WITH (tokenizer='standard', filters='lowercase,english_stop,english_stemmer'); + +CREATE INVERTED INDEX idx_message_cn ON logs (message) +WITH (indexer='native', tokenizer='chinese', filters='lowercase,english_stop', with_position='true'); ``` ### CREATE VECTOR INDEX