Function: org-roam-node-from-title-or-alias

org-roam-node-from-title-or-alias is a byte-compiled function defined in org-roam-node.el.

Signature

(org-roam-node-from-title-or-alias S &optional NOCASE)

Documentation

Return an org-roam-node for the node with title or alias S.

Return nil if the node does not exist. Throw an error if multiple choices exist.

If NOCASE is non-nil, the query is case insensitive. It is case sensitive otherwise.

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-node.el
(defun org-roam-node-from-title-or-alias (s &optional nocase)
  "Return an `org-roam-node' for the node with title or alias S.
Return nil if the node does not exist.
Throw an error if multiple choices exist.

If NOCASE is non-nil, the query is case insensitive.
It is case sensitive otherwise."
  (let ((matches (seq-uniq
                  (append
                   (org-roam-db-query (vconcat [:select [id] :from nodes
                                                :where (= title $s1)]
                                               (if nocase [ :collate NOCASE ]))
                                      s)
                   (org-roam-db-query (vconcat [:select [node-id] :from aliases
                                                :where (= alias $s1)]
                                               (if nocase [ :collate NOCASE ]))
                                      s)))))
    (cond
     ((seq-empty-p matches)
      nil)
     ((= 1 (length matches))
      (org-roam-populate (org-roam-node-create :id (caar matches))))
     (t
      (user-error "Multiple nodes exist with title or alias \"%s\"" s)))))