Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display the first line of notes when searching #35

Open
dullboyliu opened this issue Nov 10, 2020 · 4 comments
Open

Display the first line of notes when searching #35

dullboyliu opened this issue Nov 10, 2020 · 4 comments

Comments

@dullboyliu
Copy link

Hi, this workflow is very useful and help me a lot! Thank you for your great job. In my work setting, it's more important to display the fist line of notes than display tags. I know little about coding. Could you help me and add this feature to your workflow? For example, press "option" to display the first line. Thank you very much!

@drgrib
Copy link
Owner

drgrib commented Nov 10, 2020

Unfortunately, this will be an unresolvable conflict with my personal use case for now because pressing modifier keys (e.g. option) can only display static text, not dynamic values. So the only way to implement this would be to replace the current tag display with the first line and, personally, I use tags. The first line of my own notes usually contains a header that would be of little use to me compared to tags.

@dullboyliu
Copy link
Author

Thank you for your nice reply. If it was not complicated, could you tell me how to modify your workflow in order to display the first line instead tags? That would be great help for my work. Thank you!

@drgrib
Copy link
Owner

drgrib commented Nov 11, 2020

Sure thing, assuming you want to fork the repo and maintain your own copy. Unfortunately, it is pretty complicated depending on how much experience you have with SQL queries and Go.

The hardest part is getting the first line of the notes. You'll need to modify the queries I've written here (the ones that contain SELECT) to return the ZTEXT as part of the query:
https://github.com/drgrib/alfred-bear/blob/964ca21bd0c8765e8b013eb33490befd20eaa7d2/db/db.go

Then you'll need to parse the returned ZTEXT string to get the first line. I'm not sure what the most performance efficient way to do that is.

Once you've done that, you would have to change these two lines of code to return the first line you parse instead of the tags like I am:
https://github.com/drgrib/alfred-bear/search?q=subtitle

I wish I had an easier answer for you. Unfortunately, I don't have time to invest into figuring out more detail than that especially since implementing this would negate my own most useful setup.

@dullboyliu
Copy link
Author

Thanks a lot!! Although now it's hard for me to understand your instruction, it's really a pleasure to figure it out, code by myself and finally see it work through. Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants