Query NOW tasks from active projects

Hi, I have some tasks on pages that I want to query.

type:: #Project
status:: Active

I have this query:

#+BEGIN_QUERY
{
:title [:b "Active Tasks in Active Projects"]
:query [:find (pull ?b [*])
:where
   [?b :block/page ?p]
   [?p :block/properties ?prop]
   [(get ?prop :type) ?type]
   [(= "Project" ?type)]
   [(get ?prop :status) ?status]
   [(= "Active" ?status)]
   [?b :block/marker ?marker]
   [(contains? #{"DOING" "NOW"} ?marker)]
]
:breadcrumb-show? false
}
#+END_QUERY

It shows no results.

It does show some results when I change

[(= "Project" ?type)] to [(= #{"Project"} ?type)] but honestly, I have no idea why.

I came up with this query:

#+BEGIN_QUERY
{
:title [:b "Active Tasks in Active Projects"]
:query [:find (pull ?b [*])
:where
   [?b :block/page ?p]
   (page-property ?p :typ "Project")
   (page-property ?p :status "Active")
   [?b :block/marker ?marker]
   [(contains? #{"DOING" "NOW"} ?marker)]
]
}
#+END_QUERY

And it works as expected, but it’s really slow. And the graph is brand new so there’s not that much data to go through.

Can anyone help me with this? What am I doing wrong?

Also, What if a pages has multiple types: type:: #Project #eBook?

Thank you!

It’s because the properties are stored in a set when they are page references instead of plain text.
So to query for them we have to use contains.
This works no matter the number of page references.

[(contains? ?type "Project")]

https://clojuredocs.org/clojure.core/contains_q#example-542692cdc026201cdc326d2f

This is what is in the data, btw.

:block/properties {:type #{"Project" "eBook"}, :status "Active"}