mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix consistency checks for fulltext
This commit is contained in:
parent
905eb303bc
commit
8fb6edad67
@ -1,4 +1,4 @@
|
|||||||
FROM node:10.15.0-alpine
|
FROM node:10.15.3-alpine
|
||||||
|
|
||||||
# Create app directory
|
# Create app directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
PKG_DIR=dist/trilium-linux-x64-server
|
PKG_DIR=dist/trilium-linux-x64-server
|
||||||
NODE_VERSION=10.15.0
|
NODE_VERSION=10.15.3
|
||||||
|
|
||||||
rm -r $PKG_DIR
|
rm -r $PKG_DIR
|
||||||
mkdir $PKG_DIR
|
mkdir $PKG_DIR
|
||||||
|
@ -359,21 +359,39 @@ async function findLogicIssues() {
|
|||||||
logFix(`Removed link ${linkId} because target note ${targetNoteId} is also deleted.`);
|
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(`
|
await findAndFixIssues(`
|
||||||
SELECT
|
SELECT
|
||||||
noteId
|
noteId
|
||||||
FROM
|
FROM
|
||||||
notes
|
notes
|
||||||
JOIN note_contents USING(noteId)
|
JOIN note_contents USING(noteId)
|
||||||
LEFT JOIN note_fulltext USING(noteId)
|
JOIN note_fulltext USING(noteId)
|
||||||
WHERE
|
WHERE
|
||||||
notes.isDeleted = 0
|
notes.isDeleted = 0
|
||||||
|
AND notes.isProtected = 0
|
||||||
AND (note_fulltext.noteId IS NULL
|
AND (note_fulltext.noteId IS NULL
|
||||||
OR note_fulltext.titleHash != notes.hash
|
OR note_fulltext.titleHash != notes.hash
|
||||||
OR note_fulltext.contentHash != note_contents.hash)`,
|
OR note_fulltext.contentHash != note_contents.hash)`,
|
||||||
async ({noteId}) => {
|
async ({noteId}) => {
|
||||||
noteFulltextService.triggerNoteFulltextUpdate(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.`);
|
logFix(`Triggered fulltext update of note ${noteId} since it was out of sync.`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user