Datacore is available as a
Community Pluginin Obsidian: GitHub - blacksmithgu/datacore: Work-in-progress successor to Dataview with a focus on UX and speed. · GitHub
An application of the Datacore plugin in Obsidian, which supports JavaScript-esque efficient queries for large vaults. In this case, (to elaborate upon the title) this code is meant to extract the parent file’s name/link of all list items within pages in a vault in a quick manner (that takes <1 second for my 4,000+ file vault!), with this specific query being for whether that list item contains #pin.
This code references this section of the documentation of Datacore: Queries | Datacore
return function View() {
// Strategy: Stay with the parent query
const parentPages = dc.useQuery('@page and path("Journal") and parentof(@list-item and #pin)');
const sortedPages = dc.useArray(parentPages, array => array.sort(p => -p.$ctime));
const COLUMNS = [
{ id: "File", value: p => p.$link, width: "20%" },
{
id: "Content",
value: p => {
const children = dc.query(`@list-item and #pin and childof(id("${p.$id}"))`);
const pinNode = children.length > 0
? children[0]
: dc.query(`@list-item and #pin and subtree(id("${p.$id}"))`)[0];
const text = pinNode.$text || "";
const parts = text.split("#pin");
return parts.length > 1 ? parts[1].trim() : text;
}
}
];
return <dc.Table rows={sortedPages} columns={COLUMNS} type="block" paging={10} />;
}