Hi all, I’m playing around with making an Obsidian plugin, but I’ve run into a gap in my understanding.
Does anyone know of an API endpoint for searching file content programatically? I’ve seen a couple of plugin authors sneak into the ‘global-search’ plugin to initiate a UI search, but I don’t see any way of initiating a query from JavaScript and getting the results as a JavaScript object.
My use case is that I want a way to execute a search and then render the results differently – sorting by matched line rather than grouping by file. This would be useful for e.g. sorting task lines by title or due date. My strategy right now is to use a custom code block (like the recently-added query
block).
I don’t mind manually iterating through the notes in the vault, but I’d rather make use of the existing search engine (with its syntax, knowledge about tags and metadata, etc.) if possible.