mirror of
https://github.com/atuinsh/atuin.git
synced 2024-11-22 08:13:57 +01:00
feat: add fts5-based search
This commit is contained in:
parent
2e88321aec
commit
828181fd52
14
crates/atuin-client/migrations/20240525154323_fts5.sql
Normal file
14
crates/atuin-client/migrations/20240525154323_fts5.sql
Normal file
@ -0,0 +1,14 @@
|
||||
create virtual table history_fts using fts5(command, cwd, hostname, exit, content='history', tokenize='trigram');
|
||||
|
||||
insert into history_fts(rowid, command, cwd, exit, hostname) select rowid, command, cwd, exit, hostname from history;
|
||||
|
||||
-- Keep the index up to date
|
||||
-- We do not ever update rows
|
||||
-- for big changes, Atuin can just rebuild the history db from the store
|
||||
CREATE TRIGGER history_fts_begin AFTER INSERT ON history BEGIN
|
||||
INSERT INTO history_fts(rowid, command, cwd, exit, hostname) VALUES (new.rowid, new.command, new.cwd, new.exit, new.hostname);
|
||||
END;
|
||||
|
||||
CREATE TRIGGER history_fts_delete AFTER DELETE ON history BEGIN
|
||||
INSERT INTO history_fts(history_fts, rowid, command, cwd, exit, hostname) VALUES('delete', old.command, old.cwd, old.exit, old.hostname);
|
||||
END;
|
Loading…
Reference in New Issue
Block a user