📣
TiDB Cloud Premium 开放公测中。为企业级工作负载提供无限扩展、即时弹性伸缩和高级安全保障。此页面由 AI 自动翻译,英文原文请见此处。

刷新 NGRAM 索引



TiDB Cloud Lake 在数据摄取时会自动刷新 NGRAM 索引。当你需要回填在索引定义之前已存在的数据时,请使用 REFRESH NGRAM INDEX。

语法

REFRESH NGRAM INDEX [IF EXISTS] <index_name> ON [<database>.]<table_name>;

示例

-- Table already populated before the NGRAM index exists CREATE TABLE IF NOT EXISTS amazon_reviews_ngram(review_id INT, review STRING); INSERT INTO amazon_reviews_ngram VALUES (1, 'coffee beans from Colombia'), (2, 'best roasting kit'); -- Declare the NGRAM index afterward CREATE NGRAM INDEX idx1 ON amazon_reviews_ngram(review) WITH (ngram_size = 3); -- Refresh so the pre-existing rows are indexed REFRESH NGRAM INDEX idx1 ON amazon_reviews_ngram; -- Subsequent inserts refresh automatically in SYNC mode

文档内容是否有帮助?