Skip to content

Build your personal knowledge base with Trilium Notes

fix duplication of search results when conforming to multiple expressions in OR relation, closes #1262

zadam1fcb99fa6009
diff --git a/src/services/search/note_set.js b/src/services/search/note_set.js
index 626730d68a..6f442d4014 100644
--- a/src/services/search/note_set.js
+++ b/src/services/search/note_set.js
@@ -31,8 +31,12 @@ class NoteSet {
}
mergeIn(anotherNoteSet) {
- this.notes = this.notes.concat(anotherNoteSet.notes);
- this.noteIdSet = new Set(this.notes.map(note => note.noteId));
+ for (const note of anotherNoteSet.notes) {
+ if (!this.noteIdSet.has(note.noteId)) {
+ this.noteIdSet.add(note.noteId);
+ this.notes.push(note);
+ }
+ }
}
minus(anotherNoteSet) {