reddit / emacs
org roam - how to find note by content?
pailanderCO · 2022-02-04 23:02
Is there a way of finding an org roam note by its text (not by its title nor tags)? I've been using fzf for that, but it isn't pretty.
emage_ · 2022-02-05 00:42
If you're using consult there's a useful consult-ripgrep function, or you can make your own ripgrep function.
pailanderCO · 2022-02-05 01:05
>consult-ripgrep
Thanks for the tip. I found an example of it here: https://org-roam.discourse.group/t/using-consult-ripgrep-with-org-roam-for-searching-notes/1226
FOSSbflakes · 2022-02-05 08:14
I gather been using Deft personally which has been fine, though I hear it doesn't scale well
Kartoshk · 2022-02-05 08:52
As already mentioned "consult-ripgrep" is awesome and powerful.
One additional thought that I hope would helpful - org-roam is specifically tries to have minimal functionality and delegates /a lot/ of things to org-mode, or general tools in emacs.
So for future questions if it's not something that specifically about backlinks, but could just as well be a question about "multiple org files in directory", or just " multiple text files"
- asking more general questions you might find more help and more quickly
pailanderCO · 2022-02-05 13:56
I've also used Deft before, but as far as I know it only searches in the titles (and/or tags), not in the contents.
[deleted] · 2022-02-05 14:41
It definitely searches content. I was going to recommend it.
ftrx · 2022-02-05 19:00
It search full-text, but do not like the ID/drawer *before* #+title: in notes, there are AFAIK some hacks to circumvent that but... ripgrapping the org-roam-directory is much nicer/faster IMO/IME :-)
Also you might like considering org-ql to access your notes out of queries on metadata, that's a long shot since you need to craft them along with proper queries, but might be really useful sometime, suppose for instance you have a note a contract and a day you are willing to know all contracts you have: org-ql can answer other methods can't do much...
pailanderCO · 2022-02-05 21:47
Yeah, you're right. I had to turn regex incremental search on.
pailanderCO · 2022-02-05 21:48
I'll give a look at org-ql. Thanks.
ftrx · 2022-02-05 22:36
Your welcome :-)
my suggestion is trying something like
* A book title
:PROPERTIES:
:ID: 2e48ead7-203e-546d-b02c-3970bf75046a
:kind: book
:year: 2019
:publisher: Independently published
:language: english
:author: Foo Bar
:END:
[[elisp:(org-ql-search (org-agenda-files) '(and (property "kind" "book") (property "year" "2019")) :title "My book(s) notes")][click to see all books notes I made in 2019]]
Of course with few "books note" spread in various notes (I've used org-agenda-files for where to search, but it can be anything, for instance `(file-expand-wildcards "~/my/notes/*.org")`) and the query again somewhere also in scratch buffer.
Org-ql do support an interactive usage, but writing like queries IMO it's not hyper natural even in non-lisp-y form, while keeping queries and yasnippets/templates for relevant headings, together, help to group different headings/notes with various criteria and you can just click on them as needed. Contracts is an example, for instance with an `:active: yes` and `:kind: contract` properties, books another, many others equivalent are possible depending of your org-mode usage. It's also possible to output query results in a buffer, as an org-table, but so far I failed to find a use-case for that... Another option is `M-x org-ql-view` with queries hard-coded in Emacs config and presented as a search&narrow list ivy/consult/helm/* style.
paretoOptimalDev · 2022-05-10 16:04
Full text search with sqlite could easily be added I think.
I created an issue:
https://github.com/org-roam/org-roam/issues/2187
pailanderCO · 2022-05-10 17:52
Good! Thanks.