-
Notifications
You must be signed in to change notification settings - Fork 5
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
add query option for full-text search #6
Comments
Thank you very much for the comments. org-roam doesn't store the contents of the files themselves. At that point, it would just duplicate everything in the org files. And I couldn't find a good solution that is not too opinionated. Which is why it wasn't added as an option to org-roam-ql. That being said, you should be able to add your own expansion function with (org-roam-ql-defexpansion 'regexp-rg
"Regex on all org files."
(lambda (regexp)
(-map
#'org-roam-node-from-id
(-non-nil (--map
;; on windows the path has a colon, hence making it relative then expanding again.
(pcase-let ((`(,file ,line ,match) (s-split ":" (f-relative it org-roam-directory))))
(org-roam-with-file (expand-file-name file org-roam-directory) nil
(goto-line (string-to-number line))
(or (org-id-get-closest)
(progn
(goto-char (point-min))
(org-id-get)))))
(--filter
(< 0 (length it))
(s-split "\n"
(with-temp-buffer
(call-process "rg" nil t "--null"
"--line-buffered"
"--color=never"
"--max-columns=1000"
"--path-separator" "/"
"--smart-case"
"--no-heading"
"--with-filename"
"--line-number"
"--search-zip"
"-j5"
"-torg"
regexp
org-roam-directory)
(buffer-string))))))))) Let me know if you have any other questions. |
Thank you for the quick response! I'll take a look and see how I can incorporate that. |
The Org-roam-ql approach to querying org-roam notes is great. There is just one missing piece to the puzzle - a query option to search the body of the notes.
There are always pieces of information that I did not think to capture as property drawers at the time of filing a note. I now have to choose to either go the org-roam-ql way and subset notes via title/tag/backlink or do a full text search (i.e. via deft). The possibility of combining the two would help tremendously.
The text was updated successfully, but these errors were encountered: