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
Better Canvas search to prevent metadata beeing searched in fulltext
CobriMediaJuliene63d3489b067
diff --git a/src/services/search/expressions/note_content_fulltext.ts b/src/services/search/expressions/note_content_fulltext.tsindex 106d5d3e34..546191a3c8 100644--- a/src/services/search/expressions/note_content_fulltext.ts+++ b/src/services/search/expressions/note_content_fulltext.ts@@ -133,6 +133,30 @@ class NoteContentFulltextExp extends Expression {content = content.replace(/ /g, ' ');}+ else if (type === 'mindMap' && mime === 'application/json') {+ console.log("mindMap", content);+ let mindMapcontent = JSON.parse (content);+ console.log("mindMap", mindMapcontent);+ let topic = mindMapcontent.nodedata.topic;+ console.log("topic22", topic);+ content = utils.normalize(topic.toString());+ }+ else if (type === 'canvas' && mime === 'application/json') {+ interface Element {+ type: string;+ text?: string; // Optional since not all objects have a `text` property+ id: string;+ [key: string]: any; // Other properties that may exist+ }+ console.log("hier")+ let canvasContent = JSON.parse (content);+ const elements: Element [] = canvasContent.elements;+ const texts = elements+ .filter((element: Element) => element.type === 'text' && element.text) // Filter for 'text' type elements with a 'text' property+ .map((element: Element) => element.text!); // Use `!` to assert `text` is defined after filtering+ console.log(texts)+ }+return content.trim();}