Fossil SCM

Ensure that that the chatfts1 table and triggers are created in the repository db, rather than the main db, else it breaks when running via the ui command (where the checkout is the main db).

stephan 2024-06-30 10:47 fts5-chat-search
Commit cdbdaee6421987ba07de435431d2c738007c08214f21d8e0227cd1609bd8d56b
1 file changed +4 -4
+4 -4
--- src/chat.c
+++ src/chat.c
@@ -342,21 +342,21 @@
342342
db_multi_exec("ALTER TABLE chat ADD COLUMN lmtime TEXT");
343343
}
344344
345345
if( !db_table_exists("repository", "chatfts1") ){
346346
db_multi_exec(
347
- "CREATE VIRTUAL TABLE chatfts1 USING fts5("
347
+ "CREATE VIRTUAL TABLE repository.chatfts1 USING fts5("
348348
" xmsg, content=chat, content_rowid=msgid, tokenize=porter"
349349
");"
350
- "CREATE TRIGGER chat_ai AFTER INSERT ON chat BEGIN "
350
+ "CREATE TRIGGER repository.chat_ai AFTER INSERT ON chat BEGIN "
351351
" INSERT INTO chatfts1(rowid, xmsg) VALUES(new.msgid, new.xmsg);"
352352
"END;"
353
- "CREATE TRIGGER chat_ad AFTER DELETE ON chat BEGIN "
353
+ "CREATE TRIGGER repository.chat_ad AFTER DELETE ON chat BEGIN "
354354
" INSERT INTO chatfts1(chatfts1, rowid, xmsg) "
355355
" VALUES('delete', old.msgid, old.xmsg);"
356356
"END;"
357
- "INSERT INTO chatfts1(chatfts1) VALUES('rebuild');"
357
+ "INSERT INTO repository.chatfts1(chatfts1) VALUES('rebuild');"
358358
);
359359
}
360360
}
361361
362362
/*
363363
--- src/chat.c
+++ src/chat.c
@@ -342,21 +342,21 @@
342 db_multi_exec("ALTER TABLE chat ADD COLUMN lmtime TEXT");
343 }
344
345 if( !db_table_exists("repository", "chatfts1") ){
346 db_multi_exec(
347 "CREATE VIRTUAL TABLE chatfts1 USING fts5("
348 " xmsg, content=chat, content_rowid=msgid, tokenize=porter"
349 ");"
350 "CREATE TRIGGER chat_ai AFTER INSERT ON chat BEGIN "
351 " INSERT INTO chatfts1(rowid, xmsg) VALUES(new.msgid, new.xmsg);"
352 "END;"
353 "CREATE TRIGGER chat_ad AFTER DELETE ON chat BEGIN "
354 " INSERT INTO chatfts1(chatfts1, rowid, xmsg) "
355 " VALUES('delete', old.msgid, old.xmsg);"
356 "END;"
357 "INSERT INTO chatfts1(chatfts1) VALUES('rebuild');"
358 );
359 }
360 }
361
362 /*
363
--- src/chat.c
+++ src/chat.c
@@ -342,21 +342,21 @@
342 db_multi_exec("ALTER TABLE chat ADD COLUMN lmtime TEXT");
343 }
344
345 if( !db_table_exists("repository", "chatfts1") ){
346 db_multi_exec(
347 "CREATE VIRTUAL TABLE repository.chatfts1 USING fts5("
348 " xmsg, content=chat, content_rowid=msgid, tokenize=porter"
349 ");"
350 "CREATE TRIGGER repository.chat_ai AFTER INSERT ON chat BEGIN "
351 " INSERT INTO chatfts1(rowid, xmsg) VALUES(new.msgid, new.xmsg);"
352 "END;"
353 "CREATE TRIGGER repository.chat_ad AFTER DELETE ON chat BEGIN "
354 " INSERT INTO chatfts1(chatfts1, rowid, xmsg) "
355 " VALUES('delete', old.msgid, old.xmsg);"
356 "END;"
357 "INSERT INTO repository.chatfts1(chatfts1) VALUES('rebuild');"
358 );
359 }
360 }
361
362 /*
363

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button