summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-06 20:43:03 +0300
committerThanos Apollo <[email protected]>2024-08-06 20:43:03 +0300
commit3435bd162059ebe8329a52dc6cf763a7fd81fcf1 (patch)
tree3cc613b16a6722ac143e847877b9450c598db4a4 /gnosis.el
parent8473e27447ea28f6fd95069583cd8cecab966e62 (diff)
search-note: Now searches for answer as well.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/gnosis.el b/gnosis.el
index 79dd73b..c68a4f3 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -2176,10 +2176,15 @@ 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: ")))
(words (split-string query))
- (clause `(and ,@(mapcar (lambda (word)
- `(like main ,(format "%%%s%%" word)))
- words))))
- (gnosis-select 'id 'notes clause t)))
+ (clause-main `(and ,@(mapcar (lambda (word)
+ `(like main ,(format "%%%s%%" word)))
+ words)))
+ (clause-answer `(and ,@(mapcar (lambda (word)
+ `(like answer ,(format "%%%s%%" word)))
+ words))))
+ (append (gnosis-select 'id 'notes clause-main t)
+ (gnosis-select 'id 'notes clause-answer t))))
+
(defun gnosis-db-update-v2 ()
"Update to first gnosis-db version."
(emacsql-with-transaction gnosis-db