mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 01:18:44 +02:00
removed FTS5 completely
This commit is contained in:
parent
151641b659
commit
1990c9399e
@ -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"
|
@ -1 +0,0 @@
|
||||
CREATE VIRTUAL TABLE note_fulltext USING fts5(noteId UNINDEXED, title, titleHash UNINDEXED, content, contentHash UNINDEXED);
|
@ -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);
|
||||
}
|
||||
};
|
||||
module.exports = async () => {};
|
1
db/migrations/0133__drop_note_fulltext.sql
Normal file
1
db/migrations/0133__drop_note_fulltext.sql
Normal file
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS note_fulltext;
|
@ -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,
|
||||
|
@ -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>
|
||||
|
||||
|
||||
|
@ -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 check
|
||||
|
||||
if (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>
|
||||
|
@ -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 check
|
||||
|
||||
if (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;
|
@ -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 = {
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
};
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user