【发布时间】:2019-11-28 20:16:05
【问题描述】:
DROP TABLE IF EXISTS TEXTS;
CREATE TABLE TEXTS (text_id int PRIMARY KEY, text ntext,last_update datetime DEFAULT
CURRENT_TIMESTAMP);
DROP TABLE IF EXISTS FTSTEXTS;
CREATE VIRTUAL TABLE FTSTEXTS USING fts5(text,content="TEXTS",content_rowid="text_id",tokenize=unicode61);
Insert into texts (text_id,text) values (1,'first'),(2,'second'),(3,'third'),(4,'fourth');
Insert into ftstexts (rowid,text) values (1,'first'),(2,'second'),(3,'third'),(4,'fourth');
update texts set text='5555' where text_id=2;
update ftstexts set text='5555' where rowid=2;
select text from texts where text_id=(select rowid from ftstexts where text match('second') limit 1);
result is "5555"
创建表并将第 2 行的值更新为“5555”后查询
select rowid from ftstexts where text match('second') limit 1
返回 2:
如何填充 FTS 表以从 fts 搜索中排除术语“秒”?
查询在 SQLITEStudio 3.2.1 上运行
【问题讨论】:
-
不要对外部内容表使用更新。删除旧的并插入新的。请参阅sqlite.org/fts5.html#external_content_tables 处的示例触发器
标签: sqlite full-text-search populate