(db: DatabaseAdapter, entries: Array<{ id: number; content: string | null }>)
| 89 | * Used during incremental import to sync new messages. |
| 90 | */ |
| 91 | export function insertFtsEntries(db: DatabaseAdapter, entries: Array<{ id: number; content: string | null }>): void { |
| 92 | if (!hasFtsTable(db)) return |
| 93 | |
| 94 | const insertFts = db.prepare('INSERT INTO message_fts(rowid, content) VALUES (?, ?)') |
| 95 | |
| 96 | db.transaction(() => { |
| 97 | for (const entry of entries) { |
| 98 | if (entry.content) { |
| 99 | const tokens = tokenizeForFts(entry.content) |
| 100 | if (tokens) { |
| 101 | insertFts.run(entry.id, tokens) |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | }) |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Search messages using FTS5, returning matching rowids. |
no test coverage detected