|
|
|
|
@ -2,18 +2,18 @@ CREATE VIRTUAL TABLE news_resource_fts
|
|
|
|
|
USING FTS4(
|
|
|
|
|
news_resource_id TEXT NOT NULL,
|
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
|
content TEXT NOT NULL,
|
|
|
|
|
content TEXT NOT NULL
|
|
|
|
|
);
|
|
|
|
|
-- Triggers to keep the FTS index up to date.
|
|
|
|
|
CREATE TRIGGER news_resource_ai AFTER INSERT ON news_resource BEGIN
|
|
|
|
|
INSERT INTO news_resource_fts (rowid, news_resource_id, title, content) VALUES (new.rowid, new.id, new.title, new.content);
|
|
|
|
|
END;
|
|
|
|
|
CREATE TRIGGER news_resource_ad AFTER DELETE ON news_resource BEGIN
|
|
|
|
|
INSERT INTO news_resource_fts (news_resource_fts, rowid, news_resource_id, title, content) VALUES ('delete', old.rowid, old.id, old.title, old.content);
|
|
|
|
|
DELETE FROM news_resource_fts WHERE news_resource_id = old.id;
|
|
|
|
|
END;
|
|
|
|
|
CREATE TRIGGER news_resource_au AFTER UPDATE ON news_resource BEGIN
|
|
|
|
|
INSERT INTO news_resource_fts (news_resource_fts, rowid, news_resource_id, title, content) VALUES ('delete', old.rowid, old.id, old.title, old.content);
|
|
|
|
|
INSERT INTO news_resource_fts (rowid, news_resource_id, title, content) VALUES (new.rowid, new.id, new.title, new.content);
|
|
|
|
|
DELETE FROM news_resource_fts WHERE news_resource_id = old.id;
|
|
|
|
|
INSERT INTO news_resource_fts (news_resource_id, title, content) VALUES (new.id, new.title, new.content);
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
|
|
insert:
|
|
|
|
|
|