Skip to content

Build your personal knowledge base with Trilium Notes

fix correct number of related attributes

zadam9ce224d4c5ba
diff --git a/src/routes/api/search.js b/src/routes/api/search.js
index 9bdb28f3f4..aaafe27870 100644
--- a/src/routes/api/search.js
+++ b/src/routes/api/search.js
@@ -247,6 +247,12 @@ function getRelatedNotes(req) {
const allResults = matchingNameAndValue.concat(matchingName);
+ const allResultNoteIds = new Set();
+
+ for (const record of allResults) {
+ allResultNoteIds.add(record.noteId);
+ }
+
for (const record of allResults) {
if (results.length >= 20) {
break;
@@ -260,7 +266,7 @@ function getRelatedNotes(req) {
}
return {
- count: allResults.length,
+ count: allResultNoteIds.size,
results
};
}