Better Canvas search to prevent metadata beeing searched in fulltext

This commit is contained in:
CobriMediaJulien 2024-12-08 22:52:51 +01:00 committed by GitHub
parent 336fff9099
commit e63d3489b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
}