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
fix consistency checks for fulltext
zadam8fb6edad677d
diff --git a/Dockerfile b/Dockerfileindex 5df47e98ac..1ae88323f2 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,4 +1,4 @@-FROM node:10.15.0-alpine+FROM node:10.15.3-alpine# Create app directoryWORKDIR /usr/src/appdiff --git a/bin/build-server.sh b/bin/build-server.shindex 326220f6fe..2c0ceb33d6 100755--- a/bin/build-server.sh+++ b/bin/build-server.sh@@ -1,7 +1,7 @@#!/usr/bin/env bashPKG_DIR=dist/trilium-linux-x64-server-NODE_VERSION=10.15.0+NODE_VERSION=10.15.3rm -r $PKG_DIRmkdir $PKG_DIRdiff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.jsindex 04e2cb135e..badd141aae 100644--- a/src/services/consistency_checks.js+++ b/src/services/consistency_checks.js@@ -359,21 +359,39 @@ 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(`SELECTnoteIdFROMnotesJOIN note_contents USING(noteId)- LEFT JOIN note_fulltext USING(noteId)+ JOIN note_fulltext USING(noteId)WHEREnotes.isDeleted = 0+ AND notes.isProtected = 0AND (note_fulltext.noteId IS NULLOR note_fulltext.titleHash != notes.hashOR 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.`);});}