メインコンテンツへスキップ
メインコンテンツへスキップ

mergeTreeTextIndex テーブル関数

MergeTree テーブル内のテキスト索引を表す Dictionary です。 トークンとそれぞれのポスティングリストに関するメタデータを返します。 インデックスのインスペクションに利用できます。

構文

mergeTreeTextIndex(database, table, index_name)

引数

引数説明
databaseテキスト索引を読み込むデータベース名。
tableテキスト索引を読み込むテーブル名。
index_name読み込むテキスト索引名。

返り値

トークンとそのポスティングリストメタデータを含むテーブルオブジェクト。

使用例

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);

結果:

   ┌─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 │
   └───────────┴────────┴────────────────────────┴─────────────┴────────────────────┴───────────────────────┴──────────────────┴─────────────────────────┘