Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
small refactorings
zadam5fd58def1145
diff --git a/src/services/search/expressions/note_cache_flat_text.js b/src/services/search/expressions/note_cache_flat_text.jsindex 9443161401..bbb5cbcea3 100644--- a/src/services/search/expressions/note_cache_flat_text.js+++ b/src/services/search/expressions/note_cache_flat_text.js@@ -87,14 +87,9 @@ class NoteCacheFlatTextExp extends Expression {if (note.type.includes(token) || note.mime.includes(token)) {foundAttrTokens.push(token);}- }-- for (const attribute of note.ownedAttributes) {- const lcName = attribute.name.toLowerCase();- const lcValue = attribute.value.toLowerCase();- for (const token of this.tokens) {- if (lcName.includes(token) || lcValue.includes(token)) {+ for (const attribute of note.ownedAttributes) {+ if (attribute.name.includes(token) || attribute.value.includes(token)) {foundAttrTokens.push(token);}}diff --git a/src/services/search/services/search.js b/src/services/search/services/search.jsindex 51b45bedd9..eb7be931b0 100644--- a/src/services/search/services/search.js+++ b/src/services/search/services/search.js@@ -133,6 +133,8 @@ function searchNotesForAutocomplete(query) {}function highlightSearchResults(searchResults, highlightedTokens) {+ highlightedTokens = Array.from(new Set(highlightedTokens));+// we remove < signs because they can cause trouble in matching and overwriting existing highlighted chunks// which would make the resulting HTML string invalid.// { and } are used for marking <b> and </b> tag (to avoid matches on single 'b' character)