MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / insertFtsEntries

Function insertFtsEntries

packages/node-runtime/src/fts/index.ts:91–106  ·  view source on GitHub ↗
(db: DatabaseAdapter, entries: Array<{ id: number; content: string | null }>)

Source from the content-addressed store, hash-verified

89 * Used during incremental import to sync new messages.
90 */
91export 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.

Callers 2

incrementalImportFunction · 0.90
incrementalImportFunction · 0.90

Calls 5

tokenizeForFtsFunction · 0.90
hasFtsTableFunction · 0.85
prepareMethod · 0.65
transactionMethod · 0.65
runMethod · 0.65

Tested by

no test coverage detected