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

Feature Request: Search Current Folder

Open chrisgrieser opened this issue 2 years ago • 2 comments

we have a search for the current file, and for the whole vault. A middle ground to search only a specific folder might also be quite useful? 🤔

chrisgrieser avatar May 03 '22 15:05 chrisgrieser

Aside from "that would be nice to have", is there a need for that feature? Do you feel that the Vault Search is not sufficient by itself to find your notes, or that it would be faster to manually select a folder instead of just refining your current search or scrolling down a bit? That's a genuine question, as my vault isn't really big.

Maybe indexing and weighting the full path could be an alternative solution? I just wish to avoid any user interaction that is not required.

scambier avatar Aug 01 '22 08:08 scambier

Aside from "that would be nice to have", is there a need for that feature?

Right now and for me, it's more of an "nice to have" feature. Tbh, I couldn't say whether refining the search query or restricting search to a folder would be more efficient. But I assume with a big vault and a common search string, it might be necessary to get useful results 🤔

chrisgrieser avatar Aug 01 '22 09:08 chrisgrieser

+1 I have a use case for this feature.

Every time I encountered a problem that I have trouble debugging I will write a playbook. It has description of the issue, ways to verify the issue, and step by step instruction to solve the issue.

I'm using obsidian to manage my playbook. I organize playbook entries by folder based on the domain it solving, and I use tags to tag topics the playbook entry is relevant to. I also archive the playbook for historical purpose by moving them to the archive folder. I also have a dedicated file to search playbook entries with dataviewjs.

If I search with Vault search, it will search all the of my playbook entries including those inside the archive. Same thing also applies for dataview API. So folder exclusions would be nice for my use case. For now, I have look at the result and see if it's inside the archive folder or not.

Another scenario that I can think of, but not currently my need, is to narrow down search by folder inclusion. For instance, my workplace, college, and my home have some but completely different vpn issue. It would be nice if I can search only inside my college folder so I don't have to scroll results from the other two folders.

dnswd avatar Mar 04 '23 19:03 dnswd

I've recently updated Omnisearch so you can search for the note path, would it help with your use-case in the meantime? I've postponed this feature because I don't really know how to implement the UI for this.

How would you like to select the "current" folder?

scambier avatar Mar 05 '23 12:03 scambier

I've recently updated Omnisearch so you can search for the note path, would it help with your use-case in the meantime? I've postponed this feature because I don't really know how to implement the UI for this.

Thanks for the quick reply! Yeah it worked pretty well at the moment. It will do for now.

How would you like to select the "current" folder?

I couldn't think any better way to search current folder than using keyword filtering. Obsidian already have keyword filtering, but it would be awesome if it's also available in omnisearch.

Example keyword-filtering query would be:

  • path:here vpn for searching "vpn" in active tab's current working directory.
  • ext:pdf gossipsub latency for searching "gossipsub" and "latency" exclusively inside pdfs
  • -ext:pdf "md to pdf" for searching "md to pdf" inside vaults excluding pdf files
  • path:**/review** name:adrian for searching a file with a name containing "adrian" inside review folder

I realized this has become a rather extensive wish rather than a simple feature request. But i think keywords is a good way to implement inclusive/exclusive filter in full-text search. It's also possible to add more keywords in the future. I'm not familiar with MiniSearch but I can see this is too much to ask.

If you think this is a good idea, I might try to tinker around in my machine.

dnswd avatar Mar 07 '23 08:03 dnswd

The key:value sounds like a good idea, and easily extensible.

scambier avatar Mar 07 '23 08:03 scambier

Added the fields path: and ext: in 1.14.0-beta.1. Will add documentation once published in stable

scambier avatar Apr 09 '23 07:04 scambier