I often use the namespace feature, such as
#book/history
#book/program
#program/python
and so on.
Now I want to create a query that retrieves blocks containing both book and python in namespace text. I have tried {{query (and [[book]] [[python]])}}
, but it didn’t work as expected. Can someone provide some guidance?
If I understand your intention, one way could be this advanced query:
#+BEGIN_QUERY
{
:query [
:find (pull ?b [*])
:where
[?b :block/refs ?ref1]
[?ref1 :block/name ?name1]
[(clojure.string/includes? ?name1 "book")]
[?b :block/refs ?ref2]
[?ref2 :block/name ?name2]
[(clojure.string/includes? ?name2 "python")]
]
}
#+END_QUERY
2 Likes