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:
parent
65d87220de
commit
5ecac211ae
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user