Using 'contains?' on bracketed vs non-bracketed property values

I’m curious about the behavior of contains? with block properties. Here’s a short advanced query:

#+BEGIN_QUERY
{
:title [:h3 "Property type: 'project'"]
:query [:find (pull ?b [*])
:where
   [?b :block/page ?p]
   [?p :block/properties ?prop]
   [(get ?prop :type) ?type]
   [(contains? ?type "project")]
]
}
#+END_QUERY

Given pages or blocks with type:: [[project]] or type:: project, the query only returns blocks with the double-bracketed value ([[project]]).

If I change the [(contains? ?type "project")] to [(= "project" ?type)], the query returns blocks with or without double-brackets only blocks without double brackets, which makes sense.

But the behavior of contains? in this case is confusing to me.

On a side note, are there compelling reasons to always use double brackets when defining properties?

1 Like