Next: , Previous: , Up: Ecosystem   [Contents]


18.2.3 Full-text search interface with Deft

Deft provides a nice interface for browsing and filtering org-roam notes.

  (use-package deft
    :after org
    :bind
    ("C-c n d" . deft)
    :custom
    (deft-recursive t)
    (deft-use-filter-string-for-filename t)
    (deft-default-extension "org")
    (deft-directory "/path/to/org-roam-files/"))

If the title of the Org file is not the first line, you might not get nice titles. You may choose to patch this to use org-roam’s functionality. Here I’m using el-patch:

  (use-package el-patch
    :straight (:host github
                     :repo "raxod502/el-patch"
                     :branch "develop"))

  (eval-when-compile
    (require 'el-patch))

  (use-package deft
    ;; same as above...
    :config/el-patch
    (defun deft-parse-title (file contents)
      "Parse the given FILE and CONTENTS and determine the title.
  If `deft-use-filename-as-title' is nil, the title is taken to
  be the first non-empty line of the FILE.  Else the base name of the FILE is
  used as title."
      (el-patch-swap (if deft-use-filename-as-title
                         (deft-base-filename file)
                       (let ((begin (string-match "^.+$" contents)))
                         (if begin
                             (funcall deft-parse-title-function
                                      (substring contents begin (match-end 0))))))
                     (org-roam--get-title-or-slug file))))

The Deft interface can slow down quickly when the number of files get huge. Notdeft is a fork of Deft that uses an external search engine and indexer.