插入或替换到 FTS table

INSERT or REPLACE into FTS table

这是我的数据库结构

CREATE VIRTUAL TABLE Products_fts USING fts4(PrdID, ConcatSearchField)
CREATE UNIQUE INDEX CategoryProduct_MM_CatID_PrdID_idx ON CategoryProduct_MM(CategoryID,PrdID)
CREATE INDEX CategoryProduct_MM_CatID_idx ON CategoryProduct_MM(CategoryID)
CREATE INDEX CategoryProduct_MM_PrdID_idx ON CategoryProduct_MM(PrdID)

我需要从另一个具有相同结构的 table 更新它。

Insert or Replace into Products_fts select * from mydb.Products_fts

数据已插入,但重复了。如何插入或替换?

FTS table 包含隐藏的 rowid 字段,可用于执行替换

INSERT OR REPLACE 
INTO Products_fts (rowid, PrdID, ConcatSearchField) 
SELECT PrdID AS rowid, PrdID, ConcatSearchField FROM mydb.Products_fts