From fa51be84b76ebf8616aa10097030abf32264885e Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 16 Apr 2024 14:51:16 +0300 Subject: gnosis-search-note: Adjust for queries with multiple words --- gnosis.el | 8 ++++++-- 1 file 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 -- cgit v1.2.3