diff --git a/packages/lib/services/searchengine/SearchEngineUtils.ts b/packages/lib/services/searchengine/SearchEngineUtils.ts index 7c2f634ee..0c547972f 100644 --- a/packages/lib/services/searchengine/SearchEngineUtils.ts +++ b/packages/lib/services/searchengine/SearchEngineUtils.ts @@ -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); } }