Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
removed FTS5 completely
zadam1990c9399ec8
diff --git a/bin/export-schema.sh b/bin/export-schema.shindex a75983dd80..152bcd0e03 100755--- a/bin/export-schema.sh+++ b/bin/export-schema.sh@@ -2,6 +2,6 @@SCHEMA_FILE_PATH=db/schema.sql-sqlite3 ~/trilium-data/document.db .schema | grep -v "sqlite_sequence" | grep -v "note_fulltext_" > "$SCHEMA_FILE_PATH"+sqlite3 ~/trilium-data/document.db .schema | grep -v "sqlite_sequence" > "$SCHEMA_FILE_PATH"echo "DB schema exported to $SCHEMA_FILE_PATH"\ No newline at end of filediff --git a/db/migrations/0128__add_note_fulltext.sql b/db/migrations/0128__add_note_fulltext.sqlindex d9910230a8..e69de29bb2 100644--- a/db/migrations/0128__add_note_fulltext.sql+++ b/db/migrations/0128__add_note_fulltext.sql@@ -1 +0,0 @@-CREATE VIRTUAL TABLE note_fulltext USING fts5(noteId UNINDEXED, title, titleHash UNINDEXED, content, contentHash UNINDEXED);diff --git a/db/migrations/0129__fill_note_fulltext.js b/db/migrations/0129__fill_note_fulltext.jsindex 1709d10fb5..3bd8337a09 100644--- a/db/migrations/0129__fill_note_fulltext.js+++ b/db/migrations/0129__fill_note_fulltext.js@@ -1,10 +1 @@-const repository = require('../../src/services/repository');-const noteFulltextService = require('../../src/services/note_fulltext');--module.exports = async () => {- const notes = await repository.getEntities('SELECT * FROM notes WHERE isDeleted = 0 AND isProtected = 0');-- for (const note of notes) {- await noteFulltextService.updateNoteFulltext(note);- }-};\ No newline at end of file+module.exports = async () => {};\ No newline at end of filediff --git a/db/migrations/0133__drop_note_fulltext.sql b/db/migrations/0133__drop_note_fulltext.sqlnew file mode 100644index 0000000000..7758428749--- /dev/null+++ b/db/migrations/0133__drop_note_fulltext.sql@@ -0,0 +1 @@+DROP TABLE IF EXISTS note_fulltext;\ No newline at end of filediff --git a/db/schema.sql b/db/schema.sqlindex c015f826bd..fd41ad1c34 100644--- a/db/schema.sql+++ b/db/schema.sql@@ -1,5 +1,3 @@-CREATE VIRTUAL TABLE note_fulltext USING fts5(noteId UNINDEXED, title, titleHash UNINDEXED, content, contentHash UNINDEXED)-/* note_fulltext(noteId,title,titleHash,content,contentHash) */;CREATE TABLE IF NOT EXISTS "sync" (`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,`entityName` TEXT NOT NULL,diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.htmlindex 1cf2ff4337..d0efab35df 100644--- a/docs/backend_api/Note.html+++ b/docs/backend_api/Note.html@@ -396,7 +396,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line36">line 36</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line35">line 35</a></li></ul></dd>@@ -581,7 +581,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line347">line 347</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line345">line 345</a></li></ul></dd>@@ -746,7 +746,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line216">line 216</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line214">line 214</a></li></ul></dd>@@ -922,7 +922,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line358">line 358</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line356">line 356</a></li></ul></dd>@@ -1026,7 +1026,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line645">line 645</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line643">line 643</a></li></ul></dd>@@ -1126,7 +1126,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line673">line 673</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line671">line 671</a></li></ul></dd>@@ -1230,7 +1230,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line659">line 659</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line657">line 657</a></li></ul></dd>@@ -1334,7 +1334,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line75">line 75</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line74">line 74</a></li></ul></dd>@@ -1434,7 +1434,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line534">line 534</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line532">line 532</a></li></ul></dd>@@ -1665,7 +1665,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line557">line 557</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line555">line 555</a></li></ul></dd>@@ -1861,7 +1861,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line595">line 595</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line593">line 593</a></li></ul></dd>@@ -2057,7 +2057,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line604">line 604</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line602">line 602</a></li></ul></dd>@@ -2157,7 +2157,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line111">line 111</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line109">line 109</a></li></ul></dd>@@ -2306,7 +2306,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line445">line 445</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line443">line 443</a></li></ul></dd>@@ -2471,7 +2471,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line241">line 241</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line239">line 239</a></li></ul></dd>@@ -2636,7 +2636,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line233">line 233</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line231">line 231</a></li></ul></dd>@@ -2789,7 +2789,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line457">line 457</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line455">line 455</a></li></ul></dd>@@ -2897,7 +2897,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line620">line 620</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line618">line 618</a></li></ul></dd>@@ -3001,7 +3001,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line638">line 638</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line636">line 636</a></li></ul></dd>@@ -3101,7 +3101,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line201">line 201</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line199">line 199</a></li></ul></dd>@@ -3205,7 +3205,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line685">line 685</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line683">line 683</a></li></ul></dd>@@ -3358,7 +3358,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line451">line 451</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line449">line 449</a></li></ul></dd>@@ -3523,7 +3523,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line257">line 257</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line255">line 255</a></li></ul></dd>@@ -3688,7 +3688,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line249">line 249</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line247">line 247</a></li></ul></dd>@@ -3841,7 +3841,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line469">line 469</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line467">line 467</a></li></ul></dd>@@ -3997,7 +3997,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line463">line 463</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line461">line 461</a></li></ul></dd>@@ -4105,7 +4105,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line611">line 611</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line609">line 609</a></li></ul></dd>@@ -4205,7 +4205,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line182">line 182</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line180">line 180</a></li></ul></dd>@@ -4313,7 +4313,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line629">line 629</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line627">line 627</a></li></ul></dd>@@ -4413,7 +4413,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line208">line 208</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line206">line 206</a></li></ul></dd>@@ -4589,7 +4589,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line338">line 338</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line336">line 336</a></li></ul></dd>@@ -4693,7 +4693,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line652">line 652</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line650">line 650</a></li></ul></dd>@@ -4846,7 +4846,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line433">line 433</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line431">line 431</a></li></ul></dd>@@ -4999,7 +4999,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line439">line 439</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line437">line 437</a></li></ul></dd>@@ -5108,7 +5108,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line265">line 265</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line263">line 263</a></li></ul></dd>@@ -5190,7 +5190,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line170">line 170</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line168">line 168</a></li></ul></dd>@@ -5294,7 +5294,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line162">line 162</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line160">line 160</a></li></ul></dd>@@ -5398,7 +5398,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line157">line 157</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line155">line 155</a></li></ul></dd>@@ -5502,7 +5502,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line152">line 152</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line150">line 150</a></li></ul></dd>@@ -5606,7 +5606,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line175">line 175</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line173">line 173</a></li></ul></dd>@@ -5710,7 +5710,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line270">line 270</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line268">line 268</a></li></ul></dd>@@ -5937,7 +5937,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line416">line 416</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line414">line 414</a></li></ul></dd>@@ -6133,7 +6133,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line520">line 520</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line518">line 518</a></li></ul></dd>@@ -6329,7 +6329,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line529">line 529</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line527">line 527</a></li></ul></dd>@@ -6556,7 +6556,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line390">line 390</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line388">line 388</a></li></ul></dd>@@ -6656,7 +6656,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line118">line 118</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line116">line 116</a></li></ul></dd>@@ -6756,7 +6756,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line147">line 147</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line145">line 145</a></li></ul></dd>@@ -6952,7 +6952,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line502">line 502</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line500">line 500</a></li></ul></dd>@@ -7148,7 +7148,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line511">line 511</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line509">line 509</a></li></ul></dd>@@ -7406,7 +7406,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line373">line 373</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line371">line 371</a></li></ul></dd>@@ -7633,7 +7633,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line483">line 483</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line481">line 481</a></li></ul></dd>@@ -7860,7 +7860,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line493">line 493</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line491">line 491</a></li></ul></dd>diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.htmlindex f1acd74b0e..5411ae8619 100644--- a/docs/backend_api/entities_note.js.html+++ b/docs/backend_api/entities_note.js.html@@ -35,7 +35,6 @@ const repository = require('../services/repository');const sql = require('../services/sql');const utils = require('../services/utils');const dateUtils = require('../services/date_utils');-const noteFulltextService = require('../services/note_fulltext');const syncTableService = require('../services/sync_table');const LABEL = 'label';@@ -114,7 +113,6 @@ class Note extends Entity {}this.content = res.content;- this.contentHash = res.contentHash; // used only for note_fulltext consistency checkif (this.isProtected) {if (this.isContentAvailable) {@@ -759,10 +757,6 @@ class Note extends Entity {delete pojo.content;delete pojo.contentHash;}-- async afterSaving() {- noteFulltextService.triggerNoteFulltextUpdate(this.noteId);- }}module.exports = Note;</code></pre>diff --git a/src/entities/note.js b/src/entities/note.jsindex c7451c1fdd..6b938158fb 100644--- a/src/entities/note.js+++ b/src/entities/note.js@@ -7,7 +7,6 @@ const repository = require('../services/repository');const sql = require('../services/sql');const utils = require('../services/utils');const dateUtils = require('../services/date_utils');-const noteFulltextService = require('../services/note_fulltext');const syncTableService = require('../services/sync_table');const LABEL = 'label';@@ -86,7 +85,6 @@ class Note extends Entity {}this.content = res.content;- this.contentHash = res.contentHash; // used only for note_fulltext consistency checkif (this.isProtected) {if (this.isContentAvailable) {@@ -731,10 +729,6 @@ class Note extends Entity {delete pojo.content;delete pojo.contentHash;}-- async afterSaving() {- noteFulltextService.triggerNoteFulltextUpdate(this.noteId);- }}module.exports = Note;\ No newline at end of filediff --git a/src/services/app_info.js b/src/services/app_info.jsindex 8677f0c629..3949bd2a90 100644--- a/src/services/app_info.js+++ b/src/services/app_info.js@@ -4,7 +4,7 @@ const build = require('./build');const packageJson = require('../../package');const {TRILIUM_DATA_DIR} = require('./data_dir');-const APP_DB_VERSION = 132;+const APP_DB_VERSION = 133;const SYNC_VERSION = 8;module.exports = {diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.jsindex bf8e207cbb..b09544d5ee 100644--- a/src/services/consistency_checks.js+++ b/src/services/consistency_checks.js@@ -5,7 +5,6 @@ const sqlInit = require('./sql_init');const log = require('./log');const messagingService = require('./messaging');const syncMutexService = require('./sync_mutex');-const noteFulltextService = require('./note_fulltext');const repository = require('./repository');const cls = require('./cls');const syncTableService = require('./sync_table');@@ -358,42 +357,6 @@ async function findLogicIssues() {logFix(`Removed link ${linkId} because target note ${targetNoteId} is also deleted.`);});-- // this doesn't try to find notes for which the fulltext doesn't exist at all - reason is the "archived" label- // which is inheritable and not easy to filter out such rows in consistency check which would mean that it would- // find some false positives.- await findAndFixIssues(`- SELECT- noteId- FROM- notes- JOIN note_contents USING(noteId)- JOIN note_fulltext USING(noteId)- WHERE- notes.isDeleted = 0- AND notes.isProtected = 0- AND (note_fulltext.noteId IS NULL- OR note_fulltext.titleHash != notes.hash- OR note_fulltext.contentHash != note_contents.hash)`,- async ({noteId}) => {- noteFulltextService.triggerNoteFulltextUpdate(noteId);-- logFix(`Triggered fulltext update of note ${noteId} since it was out of sync.`);- });-- await findAndFixIssues(`- SELECT- noteId- FROM- notes- JOIN note_fulltext USING(noteId)- WHERE- (notes.isDeleted = 1 OR notes.isProtected = 1)`,- async ({noteId}) => {- noteFulltextService.triggerNoteFulltextUpdate(noteId);-- logFix(`Triggered fulltext update of note ${noteId} since it was out of sync.`);- });}async function runSyncRowChecks(entityName, key) {diff --git a/src/services/note_fulltext.js b/src/services/note_fulltext.jsdeleted file mode 100644index 578541d137..0000000000--- a/src/services/note_fulltext.js+++ /dev/null@@ -1,67 +0,0 @@-const sql = require('./sql');-const repository = require('./repository');-const html2plaintext = require('html2plaintext');--const noteIdQueue = [];--async function updateNoteFulltext(note) {- if (!note) {- // this might happen when note content is being synced before note itself- return;- }-- if (note.isDeleted || note.isProtected || await note.hasLabel('archived')) {- await sql.execute(`DELETE- FROM note_fulltext- WHERE noteId = ?`, [note.noteId]);- } else {- let content = null;- let contentHash = null;-- if (['text', 'code'].includes(note.type)) {- content = await note.getContent(true);-- // might not be available during sync before note_contents is synced- if (content) {- if (note.type === 'text' && note.mime === 'text/html') {- content = html2plaintext(content);- }-- contentHash = note.contentHash;- }- }-- // optimistically try to update first ...- const res = await sql.execute(`UPDATE note_fulltext SET title = ?, titleHash = ?, content = ?, contentHash = ? WHERE noteId = ?`, [note.title, note.hash, content, contentHash, note.noteId]);-- // ... and insert only when the update did not work- if (res.stmt.changes === 0) {- await sql.execute(`INSERT INTO note_fulltext (title, titleHash, content, contentHash, noteId)- VALUES (?, ?, ?, ?, ?)`, [note.title, note.hash, content, contentHash, note.noteId]);- }- }-}--async function triggerNoteFulltextUpdate(noteId) {- if (!noteIdQueue.includes(noteId)) {- noteIdQueue.push(noteId);- }-- while (noteIdQueue.length > 0) {- await sql.transactional(async () => {- if (noteIdQueue.length === 0) {- return;- }-- const noteId = noteIdQueue.shift();- const note = await repository.getNote(noteId);-- await updateNoteFulltext(note);- });- }-}--module.exports = {- triggerNoteFulltextUpdate,- updateNoteFulltext-};\ No newline at end of filediff --git a/src/services/sync_update.js b/src/services/sync_update.jsindex 7221318da2..34a4659fc7 100644--- a/src/services/sync_update.js+++ b/src/services/sync_update.js@@ -3,7 +3,6 @@ const log = require('./log');const eventLogService = require('./event_log');const syncTableService = require('./sync_table');const eventService = require('./events');-const noteFulltextService = require('../services/note_fulltext');async function updateEntity(sync, entity, sourceId) {const {entityName} = sync;@@ -62,8 +61,6 @@ async function updateNote(entity, sourceId) {await syncTableService.addNoteSync(entity.noteId, sourceId);});- noteFulltextService.triggerNoteFulltextUpdate(entity.noteId);-log.info("Update/sync note " + entity.noteId);}}@@ -80,8 +77,6 @@ async function updateNoteContent(entity, sourceId) {await syncTableService.addNoteContentSync(entity.noteId, sourceId);});- noteFulltextService.triggerNoteFulltextUpdate(entity.noteId);-log.info("Update/sync note content for noteId=" + entity.noteId);}}