语法
mergeTreeTextIndex(database, table, index_name)
参数
| 参数 | 描述 |
|---|---|
database | 要读取其中文本索引的数据库名称。 |
table | 要读取其中文本索引的表名称。 |
index_name | 要读取的文本索引名称。 |
返回值
一个包含标记及其倒排列表元数据的表。 如果索引使用keyValuePairs 分词器,则每个标记都是 Map 列中的一个 (key, value) 键值对,结果还会包含 token_key 和 token_value 两列,分别存储该标记解码后的两个组成部分。
使用示例
Query
CREATE TABLE tab
(
id UInt64,
s String,
INDEX idx_s (s) TYPE text(tokenizer = splitByNonAlpha)
)
ENGINE = MergeTree
ORDER BY id;
INSERT INTO tab SELECT number, concatWithSeparator(' ', 'apple', 'banana') FROM numbers(500);
INSERT INTO tab SELECT 500 + number, concatWithSeparator(' ', 'cherry', 'date') FROM numbers(500);
SELECT * FROM mergeTreeTextIndex(currentDatabase(), tab, idx_s);
Response
┌─part_name─┬─token──┬─dictionary_compression─┬─cardinality─┬─num_posting_blocks─┬─has_embedded_postings─┬─has_raw_postings─┬─has_compressed_postings─┐
1. │ all_1_1_0 │ apple │ front_coded │ 500 │ 1 │ 0 │ 0 │ 0 │
2. │ all_1_1_0 │ banana │ front_coded │ 500 │ 1 │ 0 │ 0 │ 0 │
3. │ all_2_2_0 │ cherry │ front_coded │ 500 │ 1 │ 0 │ 0 │ 0 │
4. │ all_2_2_0 │ date │ front_coded │ 500 │ 1 │ 0 │ 0 │ 0 │
└───────────┴────────┴────────────────────────┴─────────────┴────────────────────┴───────────────────────┴──────────────────┴─────────────────────────┘