summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-04-16 14:00:52 +0300
committerThanos Apollo <[email protected]>2024-04-16 14:00:52 +0300
commit6000aaaafe657ffc9765eca080c998e662ba0c50 (patch)
tree66a978291765a572062d7a6343173a08cccdc5fc
parent6d9ba6f09d314a2548782ba48a8c432fed8b999e (diff)
Add gnosis-seach-note
-rw-r--r--gnosis.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnosis.el b/gnosis.el
index 61b198a..f9eaecd 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1595,7 +1595,16 @@ to improve readability."
(:foreign-key [id] :references notes [id]
:on-delete :cascade)))
+(defun gnosis-search-note (&optional query)
+ "Search for note QUERY.
+
+Return note ids for notes that match QUERY."
+ (cl-assert (or (stringp query) (eq query nil)))
+ (let ((query (or query (read-string "Search for note: "))))
+ (gnosis-select 'id 'notes `(like main ,(format "%%%s%%" query)) t)))
+
;; Dashboard
+
(defun gnosis-dashboard-output-note (id)
"Output contents for note with ID, formatted for gnosis dashboard."
(cl-loop for item in (append (gnosis-select '[main options answer tags type] 'notes `(= id ,id) t)