macedotavares / obsidian-utilities

An Alfred workflow focusing on quick entry and logging.
https://github.com/macedotavares/obsidian-utilities
GNU General Public License v3.0
169 stars 7 forks source link

Feature request: Richer search functionality #14

Open pralayb007 opened 3 years ago

pralayb007 commented 3 years ago

Hello Miguel, Hope you are doing well. I wanted to request an enhancement on the search functionality. Trying my best to detail the feature request below:

Current: The current search functionality shows the pages where the search string may be present. No additional hints are made available on the Alfred Search results, like so

image

Could be: It will be easier for a user to navigate to the right note if the search results on Alfred showed a bit more context (instead of just the file name).

For example, if there was a way to mimic the Obsidian search function (Cmd + Alt + F) right on the workflow, it would become much easier to find the relevant note to open with the additional context that is shown.

image

If it helps, here is a Bear workflow that does this (to a pretty large extent but not completely):

image

With the Cmd button (configured as Alfred modifier), the script allows to either open the note or pass the term as search string for the native Bear Search workflow.

The code to this workflow is here: https://github.com/drgrib/alfred-bear

Am not entirely sure if I have been able to explain the feature request very well, but all in all the request is boiling down to:

  1. Seeing a bit more context in the search results that helps identifies the note better (especially when there are hundreds of notes with the same search string).
  2. An ideal (but ambitious) target for this feature would be to support the native Obsidian Search functionality right on the workflow.

Please let me know if I can help you with more explanation or if you have any specific questions.

Thank you for all the great work on this workflow! I have loved using it thus far.

Pralay

macedotavares commented 3 years ago

Hi, Pralay.

I hear you loud and clear.

1. Context

For my first attempt at this feature, I wrote a custom Python script and I was working on a way of showing more context. I missed it too. However, that script relied too heavily on external libraries and the installation was often failing in other people's systems.

So I dialed it all back and made Alfred handle the search. It's much faster and more robust, but I have little to no control over how the results are returned.

I know the Bear workflow and have used it extensively. It was really good and fast, but mostly because it tapped directly into the Bear SQL database, which Obsidian doesn't have.

One option is to build my own db and use it for all the search features of the workflow. That's promising but also intimidating.

Long story short, I haven't given up on this yet. I just can't give you a timeframe.

2. Search in Obsidian

Letting Obsidian do the backstage work and displaying the results in Alfred is something that I believe to be impossible. I may be wrong, of course. What can easily be done is to "send" a search from Alfred to Obsidian via modifier key. I'll probably add this option in the near future.

pralayb007 commented 3 years ago

Thank you for the prompt response Miguel, always good to hear from you. While I have not yet looked at the code you have in the workflow (and am no way as qualified/proficient as you are), please do not mind me taking the liberty to propose some ideas (some of which I presume you would have already considered, and some would perhaps be non-sensical) :)

  1. If reliance on external libraries is something that makes things easier, do you want to consider putting some instructions around how the installations of those libraries should be done. I assume many of us would be okay to go with homebrew and/or pip based installations.
  2. Building a local DB indeed is a bit of a uphill task for sure, and I guess conflict handling and upserts on something like SQLite may cause additional headache. And am not very well versed with local MongoDBs. Wish there was a on-demand, in-mem document-based data-store (akin to ElasticSearch) but I guess the world aint there yet :)
  3. The second option you mentioned above definitely feels like a step-up. Not sure, but if it makes sense at all, but anything can be done in conjunction with Keyboard Maestro, that may be lucrative to some of us as well (even though the workflow would span across the use of two different mac apps).

No time frame needed Miguel - already grateful for what you have done thus far, but thought of dropping a line of thought or two noticing the ingenuity you are blessed with.

Thank you and have a great day ahead :)