Skip to content

Commit 02e062f

Browse files
🌐 Add LLM Translations (#862)
* 💬Generate LLM translations * docs: minor update Signed-off-by: Chojan Shang <[email protected]> * docs: minor update Signed-off-by: Chojan Shang <[email protected]> --------- Signed-off-by: Chojan Shang <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Chojan Shang <[email protected]>
1 parent 2babd82 commit 02e062f

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: 创建倒排索引
3+
sidebar_position: 1
4+
---
5+
6+
import FunctionDescription from '@site/src/components/FunctionDescription';
7+
8+
<FunctionDescription description="引入或更新版本: v1.2.405"/>
9+
10+
import EEFeature from '@site/src/components/EEFeature';
11+
12+
<EEFeature featureName='倒排索引'/>
13+
14+
在 Databend 中创建一个新的倒排索引。
15+
16+
## 语法
17+
18+
```sql
19+
CREATE [ OR REPLACE ] INVERTED INDEX [IF NOT EXISTS] <index>
20+
ON [<database>.]<table>( <column>[, <column> ...] )
21+
[ <IndexOptions> ]
22+
```
23+
24+
| 参数 | 描述 |
25+
| ---------------------- | ---------------------------------------------------------------------------------- |
26+
| `[ OR REPLACE ]` | 可选参数,指示如果索引已存在,则将其替换。 |
27+
| `[ IF NOT EXISTS ]` | 可选参数,指示仅在索引不存在时创建。 |
28+
| `<index>` | 要创建的倒排索引的名称。 |
29+
| `[<database>.]<table>` | 包含要创建索引的列的数据库和表的名称。 |
30+
| `<column>` | 要包含在索引中的列的名称。可以为同一表创建多个索引,但每个列在索引中必须是唯一的。 |
31+
| `<IndexOptions>` | 可选的索引选项,指定如何构建倒排索引。 |
32+
33+
### 索引选项
34+
35+
```sql
36+
IndexOptions ::=
37+
TOKENIZER = 'english' | 'chinese'
38+
FILTERS = 'english_stop' | 'english_stemmer' | 'chinese_stop'
39+
INDEX_RECORD = 'position' | 'basic' | 'freq'
40+
```
41+
42+
- `TOKENIZER` 指定文本如何被分割以进行索引。支持 `english`(默认)和 `chinese` 分词器。
43+
44+
- `FILTERS` 定义术语过滤的规则:
45+
46+
- 可以指定多个过滤器,用逗号分隔,例如 `FILTERS = 'english_stop,english_stemmer'`
47+
- 默认添加一个将单词转换为小写字母的过滤器。
48+
49+
| FILTERS | 描述 |
50+
| ----------------- | --------------------------------------------------------------------------------------- |
51+
| `english_stop` | 移除英语停用词,如 "a", "an", "and" 等。 |
52+
| `english_stemmer` | 将同一单词的不同形式映射到共同的一个词。例如,"walking" 和 "walked" 将被映射到 "walk"。 |
53+
| `chinese_stop` | 移除中文停用词,目前仅支持移除中文标点符号。 |
54+
55+
- `INDEX_RECORD` 决定索引数据存储的内容:
56+
57+
| INDEX_RECORD | 默认? | 描述 |
58+
| ------------ | ------ | ----------------------------------------------------------------------- |
59+
| `position` || 存储 DocId、词频和位置,占用空间最多,提供更好的评分,并支持短语查询。 |
60+
| `basic` || 仅存储 DocId,占用空间最小,但不支持如 "brown fox" 这样的短语搜索。 |
61+
| `freq` || 存储 DocId 和词频,占用中等空间,不支持短语查询,但可能提供更好的评分。 |
62+
63+
## 示例
64+
65+
```sql
66+
-- 为表 'user_comments' 中的 'comment_text' 列创建倒排索引
67+
CREATE INVERTED INDEX user_comments_idx ON user_comments(comment_text);
68+
69+
-- 使用中文分词器创建倒排索引
70+
-- 如果未指定分词器,默认使用英语
71+
-- 过滤器为 `english_stop`, `english_stemmer` 和 `chinese_stop`
72+
-- 索引记录为 `basic`
73+
CREATE INVERTED INDEX product_reviews_idx ON product_reviews(review_text) TOKENIZER = 'chinese' FILTERS = 'english_stop,english_stemmer,chinese_stop' INDEX_RECORD='basic';
74+
75+
-- 为表 'customer_feedback' 中的 'comment_title' 和 'comment_body' 列创建倒排索引
76+
-- SHOW CREATE TABLE 的输出包括创建的倒排索引的信息
77+
CREATE INVERTED INDEX customer_feedback_idx ON customer_feedback(comment_title, comment_body);
78+
79+
SHOW CREATE TABLE customer_feedback;
80+
81+
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
82+
│ Table │ Create Table │
83+
├───────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
84+
│ customer_feedback │ CREATE TABLE customer_feedback (\n comment_title VARCHAR NULL,\n comment_body VARCHAR NULL,\n SYNC INVERTED INDEX customer_feedback_idx (comment_title, comment_body)\n) ENGINE=FUSE │
85+
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
86+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: 删除倒排索引
3+
---
4+
5+
import FunctionDescription from '@site/src/components/FunctionDescription';
6+
7+
<FunctionDescription description="引入或更新于: v1.2.405"/>
8+
9+
import EEFeature from '@site/src/components/EEFeature';
10+
11+
<EEFeature featureName='倒排索引'/>
12+
13+
在 Databend 中移除一个倒排索引。
14+
15+
## 语法
16+
17+
```sql
18+
DROP INVERTED INDEX [IF EXISTS] <index> ON [<database>.]<table>
19+
```
20+
21+
## 示例
22+
23+
```sql
24+
-- 删除'customer_feedback'表上的'customer_feedback_idx'倒排索引
25+
DROP INVERTED INDEX customer_feedback_idx ON customer_feedback;
26+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: 倒排索引
3+
---
4+
5+
import IndexOverviewList from '@site/src/components/IndexOverviewList';
6+
import EEFeature from '@site/src/components/EEFeature';
7+
8+
<EEFeature featureName='倒排索引'/>
9+
10+
本页提供 Databend 中与倒排索引相关的命令参考信息。关于倒排索引的更多信息,请参阅[全文索引](/guides/performance/fulltext-index)
11+
12+
<IndexOverviewList />
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: 刷新倒排索引
3+
sidebar_position: 2
4+
---
5+
6+
import FunctionDescription from '@site/src/components/FunctionDescription';
7+
8+
<FunctionDescription description="引入或更新于: v1.2.405"/>
9+
10+
import EEFeature from '@site/src/components/EEFeature';
11+
12+
<EEFeature featureName='倒排索引'/>
13+
14+
刷新 Databend 中的倒排索引。在以下情况下需要刷新倒排索引:
15+
16+
- 在创建倒排索引之前向表中插入数据时,需要在创建后手动刷新倒排索引,以便有效地索引插入的数据。
17+
- 当倒排索引遇到问题或损坏时,需要进行刷新。如果由于某些块的倒排索引文件损坏导致倒排索引中断,例如执行查询 `where match(body, 'wiki')` 将返回错误。在这种情况下,您需要刷新倒排索引以解决问题。
18+
19+
## 语法
20+
21+
```sql
22+
REFRESH INVERTED INDEX <index> ON [<database>.]<table> [LIMIT <limit>]
23+
```
24+
25+
| 参数 | 描述 |
26+
| ---------- | -------------------------------------------------------------------- |
27+
| `<limit>` | 指定在索引刷新期间要处理的最大行数。如果未指定,将处理表中的所有行。 |
28+
29+
## 示例
30+
31+
```sql
32+
-- 刷新名为 "customer_feedback_idx" 的倒排索引,针对表 "customer_feedback"
33+
REFRESH INVERTED INDEX customer_feedback_idx ON customer_feedback;
34+
```

0 commit comments

Comments
 (0)