summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-04-16 14:51:16 +0300
committerThanos Apollo <[email protected]>2024-04-16 14:51:16 +0300
commitfa51be84b76ebf8616aa10097030abf32264885e (patch)
treecaf2d8b688afe2b0074d51bdeafb58d5e08bf55e /gnosis.el
parentdc38976f987cc640e4afc609370f38d950c48881 (diff)
gnosis-search-note: Adjust for queries with multiple words
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnosis.el b/gnosis.el
index 5235430..2908643 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1600,8 +1600,12 @@ to improve readability."
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)))
+ (let* ((query (or query (read-string "Search for note: ")))
+ (words (split-string query))
+ (clause `(and ,@(mapcar (lambda (word)
+ `(like main ,(format "%%%s%%" word)))
+ words))))
+ (gnosis-select 'id 'notes clause t)))
;; Dashboard