EDIT: Nevermind, I solved it. Thank you for sharing this.
For future searcher, the fix is at the bottom. You have to wrap the query.
ORIGINAL POST:
This looks very interesting. Is there an extra step to the conversion, as for me, it doesn’t work. Below is what I put. I am not editing the query at all at this stage.
My simple query is below, which displays x number of todos.
{{query (and (todo todo later) (not [[test]]) ) }}
The console log has this loaded which appears to match.
"Datascript query: " [:find (pull ?b [:db/id :block/uuid :block/type :block/left :block/format :block/refs :block/_refs :block/path-refs :block/tags :block/content :block/marker :block/priority :block/properties :block/pre-block? :block/scheduled :block/deadline :block/repeated? :block/created-at :block/updated-at :block/file :block/parent :block/heading-level {:block/page [:db/id :block/name :block/original-name :block/journal-day]} {:block/_parent ...}]) :where [?b :block/uuid] [?b :block/marker ?marker] [(contains? #{"TODO" "LATER"} ?marker)] (not [?b :block/path-refs [:block/name "test"]])]
However when I put this in as an advanced query it doesn’t load anything.
#+BEGIN_QUERY
[:find (pull ?b [:db/id :block/uuid :block/type :block/left :block/format :block/refs :block/_refs :block/path-refs :block/tags :block/content :block/marker :block/priority :block/properties :block/pre-block? :block/scheduled :block/deadline :block/repeated? :block/created-at :block/updated-at :block/file :block/parent :block/heading-level {:block/page [:db/id :block/name :block/original-name :block/journal-day]} {:block/_parent ...}]) :where [?b :block/uuid] [?b :block/marker ?marker] [(contains? #{"TODO" "LATER"} ?marker)] (not [?b :block/path-refs [:block/name "test"]])]
#+END_QUERY
I have tried to simplify it, to get a working starting point, with no luck.
#+BEGIN_QUERY
[
:find (pull ?b [*])
:where [?b :block/uuid] [?b :block/marker ?marker] [(contains? #{"TODO" "LATER"} ?marker)]
]
#+END_QUERY
RESULTING CORRECTION:
Looking at the docs, the queries are wrapped with a {:query }
#+BEGIN_QUERY
{
:title [:h2 "Custom title"]
:query [ :find (pull ?b [*])
:where [?b :block/uuid] [?b :block/marker ?marker] [(contains? #{"TODO" "LATER"} ?marker)]]
}
#+END_QUERY