obsidian-omnisearch icon indicating copy to clipboard operation
obsidian-omnisearch copied to clipboard

[Feature request] Option to open Omnisearch in the left sidebar like built-in Search

Open MrBertie opened this issue 1 year ago • 3 comments

Could you consider providing the option to open Omnisearch inside the left sidebar (like the built-in Search, Bookmarks, FileTree, etc.)?

Advantages: the search dialog could remain open when editing or doing other tasks, rather than the current modal dialog.

MrBertie avatar May 04 '23 08:05 MrBertie

in the meantime you can use the following dataviewjs script together with an inline dataview field Search::

const searchterm = dv.current().Search;
const results = await omnisearch.search(searchterm);
const arr = dv.array(results).sort(r => r.score, 'desc');
dv.table(['File', 'Score'], arr.map(o => [dv.fileLink(o.path), Math.round(o.score)]));

aikruger avatar Oct 19 '23 10:10 aikruger

It would be good to have a function to also display the line context of the search term as a column

aikruger avatar Oct 19 '23 10:10 aikruger

I've recently updated the API. In your example, you could get the context with o.excerpt.

About this feature request, there's very little chance I ever implement it but the API should provide everything necessary to build another plugin on top of it.

scambier avatar Oct 19 '23 18:10 scambier