diff --git a/src/ssb.db.c b/src/ssb.db.c index 3d874f4e..9dd8ee59 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -178,11 +178,11 @@ void tf_ssb_db_init(tf_ssb_t* ssb) if (populate_fts) { tf_printf("Populating full-text search...\n"); - _tf_ssb_db_exec(db, "INSERT INTO messages_fts (rowid, content) SELECT rowid, content FROM messages"); + _tf_ssb_db_exec(db, "INSERT INTO messages_fts (rowid, content) SELECT rowid, json(content) FROM messages"); tf_printf("Done.\n"); } - _tf_ssb_db_exec(db, "CREATE TRIGGER IF NOT EXISTS messages_ai AFTER INSERT ON messages BEGIN INSERT INTO messages_fts(rowid, content) VALUES (new.rowid, new.content); END"); + _tf_ssb_db_exec(db, "CREATE TRIGGER IF NOT EXISTS messages_ai AFTER INSERT ON messages BEGIN INSERT INTO messages_fts(rowid, content) VALUES (new.rowid, json(new.content)); END"); _tf_ssb_db_exec(db, "CREATE TRIGGER IF NOT EXISTS messages_ad AFTER DELETE ON messages BEGIN INSERT INTO messages_fts(messages_fts, rowid, content) VALUES ('delete', old.rowid, " "old.content); END");