1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

All: Fixed search when the index contains non-existing notes

This commit is contained in:
Laurent Cozic 2021-06-24 13:22:35 +01:00
parent 65d87220de
commit 5ecac211ae

View File

@ -70,16 +70,10 @@ export default class SearchEngineUtils {
if (isTodoAutoAdded) delete sortedNotes[idx].is_todo;
}
// Note that when the search engine index is somehow corrupted, it might contain
// references to notes that don't exist. Not clear how it can happen, but anyway
// handle it here by checking if `user_updated_time` IS NOT NULL. Was causing this
// issue: https://discourse.joplinapp.org/t/how-to-recover-corrupted-database/9367
if (noteIds.length !== notes.length) {
// remove null objects
return sortedNotes.filter(n => n);
} else {
return sortedNotes;
}
// Note that when the search engine index is somehow corrupted, it might
// contain references to notes that don't exist. Not clear how it can
// happen, but anyway handle it here. Was causing this issue:
// https://discourse.joplinapp.org/t/how-to-recover-corrupted-database/9367
return sortedNotes.filter(n => n);
}
}