-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows creating feeds selecting on multiple keywords. To allow creating feeds on new keywords that go back in time before the feed was created we now store text and a full text search index to facilitate search based look up.
- Loading branch information
Showing
12 changed files
with
220 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Drop triggers first | ||
DROP TRIGGER IF EXISTS posts_ai; | ||
DROP TRIGGER IF EXISTS posts_ad; | ||
DROP TRIGGER IF EXISTS posts_au; | ||
|
||
-- Drop FTS table | ||
DROP TABLE IF EXISTS posts_fts; | ||
|
||
-- Remove text column from posts | ||
ALTER TABLE posts DROP COLUMN text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ALTER TABLE posts ADD COLUMN text TEXT; | ||
|
||
-- Create virtual FTS table | ||
CREATE VIRTUAL TABLE posts_fts USING fts5( | ||
text, | ||
content='posts', | ||
content_rowid='id', | ||
tokenize='unicode61' | ||
); | ||
|
||
-- Trigger to keep FTS table in sync on insert | ||
CREATE TRIGGER posts_ai AFTER INSERT ON posts BEGIN | ||
INSERT INTO posts_fts(rowid, text) VALUES (new.id, new.text); | ||
END; | ||
|
||
-- Trigger to keep FTS table in sync on delete | ||
CREATE TRIGGER posts_ad AFTER DELETE ON posts BEGIN | ||
INSERT INTO posts_fts(posts_fts, rowid, text) VALUES('delete', old.id, old.text); | ||
END; | ||
|
||
-- Trigger to keep FTS table in sync on update | ||
CREATE TRIGGER posts_au AFTER UPDATE ON posts BEGIN | ||
INSERT INTO posts_fts(posts_fts, rowid, text) VALUES('delete', old.id, old.text); | ||
INSERT INTO posts_fts(rowid, text) VALUES (new.id, new.text); | ||
END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.