I’ve been racking my brain against this query for days and I can’t figure it out. I’ve done countless searches and can’t figure out what I’m doing wrong.
But what I would like to do is to query all of my daily journal entries for a block with a specific headline. My current structure is that I have a template titled “Morning Journal” that I use every day and is filled with headlines, one being “What are you grateful for?”
I would like to return all bocks underneath this headline in my graph. I thought the following would do it, but I can’t get it to work:
#+BEGIN_QUERY
{:title "Blocks containing 'string'"
:query [:find (pull ?b [*])
:in $ ?string
:where
[?b :block/string ?s]
[(clojure.string/includes? ?s ?string)]]
:inputs ["What are you grateful for?"]
:result-transform (fn [result]
(map first result))
:collapsed? false}
#+END_QUERY
And then I also tried:
#+BEGIN_QUERY
{:title "Blocks containing 'What are you grateful for?'"
:query [:find (pull ?b [*])
:in $ ?s
:where
[?b :block/string ?str]
[(clojure.string/includes? ?str ?s)]]
:inputs ["What are you grateful for?"]
:view (fn [result]
[:div.flex.flex-col
(for [block result]
^{:key (:block/uuid block)}
[:div (-> block :block/string)])])}
#+END_QUERY
Can I achieve this? I’m struggling to find an answer. Please help.