intermediate

This commit is contained in:
Fabian Freund
2024-12-12 09:44:33 +01:00
parent 0710116feb
commit 6b2ae28828
108 changed files with 5531 additions and 2265 deletions
@@ -39,7 +39,7 @@ class SearchDao extends DatabaseAccessor<ChatSearchDatabase>
required String searchString,
}) {
return db.chatQuery(
query: db.buildQuery(searchString),
query: db.buildFtsQuery(searchString),
snippetLength: snippetLength,
beforeMatch: matchPrefix,
afterMatch: matchSuffix,
@@ -1,6 +1,6 @@
import 'package:drift/drift.dart';
import 'package:lensai/features/chat_archive/data/database/daos/search.dart';
import 'package:lensai/features/query/domain/tokenizer.dart';
import 'package:lensai/features/search/domain/fts_tokenizer.dart';
part 'database.g.dart';
@@ -28,7 +28,7 @@ CREATE TRIGGER chat_after_update AFTER UPDATE ON chat BEGIN
chat_fts(chat_fts, rowid, title, content)
VALUES('delete', old.rowid, old.title, old.content);
INSERT INTO
chat_fts(chat_fts, title, content)
chat_fts(rowid, title, content)
VALUES (new.rowid, new.title, new.content);
END;
@@ -380,7 +380,7 @@ abstract class _$ChatSearchDatabase extends GeneratedDatabase {
'CREATE TRIGGER chat_after_delete AFTER DELETE ON chat BEGIN INSERT INTO chat_fts (chat_fts, "rowid", title, content) VALUES (\'delete\', old."rowid", old.title, old.content);END',
'chat_after_delete');
late final Trigger chatAfterUpdate = Trigger(
'CREATE TRIGGER chat_after_update AFTER UPDATE ON chat BEGIN INSERT INTO chat_fts (chat_fts, "rowid", title, content) VALUES (\'delete\', old."rowid", old.title, old.content);INSERT INTO chat_fts (chat_fts, title, content) VALUES (new."rowid", new.title, new.content);END',
'CREATE TRIGGER chat_after_update AFTER UPDATE ON chat BEGIN INSERT INTO chat_fts (chat_fts, "rowid", title, content) VALUES (\'delete\', old."rowid", old.title, old.content);INSERT INTO chat_fts ("rowid", title, content) VALUES (new."rowid", new.title, new.content);END',
'chat_after_update');
late final SearchDao searchDao = SearchDao(this as ChatSearchDatabase);
Selectable<ChatQueryResult> chatQuery(