1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Started integrating search engine to desktop app

This commit is contained in:
Laurent Cozic
2018-12-10 19:58:49 +01:00
parent 460f826672
commit 0a6f8b0cfe
5 changed files with 60 additions and 9 deletions

View File

@@ -219,6 +219,7 @@ class JoplinDatabase extends Database {
if (tableName == 'android_metadata') continue;
if (tableName == 'table_fields') continue;
if (tableName == 'sqlite_sequence') continue;
if (tableName.indexOf('notes_fts') === 0) continue;
chain.push(() => {
return this.selectAll('PRAGMA table_info("' + tableName + '")').then((pragmas) => {
for (let i = 0; i < pragmas.length; i++) {
@@ -260,7 +261,7 @@ class JoplinDatabase extends Database {
// default value and thus might cause problems. In that case, the default value
// must be set in the synchronizer too.
const existingDatabaseVersions = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
const existingDatabaseVersions = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
let currentVersionIndex = existingDatabaseVersions.indexOf(fromVersion);
@@ -445,6 +446,12 @@ class JoplinDatabase extends Database {
}));
}
if (targetVersion == 15) {
// NOTE: Duplicated from SearchEngine.createFtsTables()
queries.push('CREATE VIRTUAL TABLE notes_fts USING fts4(content="notes", notindexed="id", id, title, body)');
queries.push('INSERT INTO notes_fts(docid, id, title, body) SELECT rowid, id, title, body FROM notes WHERE is_conflict = 0 AND encryption_applied = 0');
}
queries.push({ sql: 'UPDATE version SET version = ?', params: [targetVersion] });
await this.transactionExecBatch(queries);