Advanced Query Question: Find page with 2 specific blocks

Hi all

I’m wondering if it is possible to split properties on a page on several blocks an use an advanced query to find specific pages.

Example Page Structure:

Product 123

- ## Summary
  type:: Product
  Name:: Product 123
  Material-Category:: Metal
  Color:: Gray
	- ### Description
		- some Text
	- ### Details
		- ### Material
		  Material:: Aluminium
		- ### Dimensions
		  Height:: 0.5cm
		  Width:: 0.8cm

Is it possible to write an advanced query to find all pages where Material=Aluminium AND type=Product?

I’m able to find each block separately, but I’m unable to “link” them together (I think they must have the same block/page value).

Any help is appreciated!

Welcome. Try something like this:

 :query [:find (pull ?page [*])
   [?details :block/properties ?details-props]
   [(get ?details-props :material) ?material]
   [(= ?material "Aluminium")]

   [?details :block/page ?page]
   [?summary :block/page ?page]

   [?summary :block/properties ?summary-props]
   [(get ?summary-props :type) ?type]
   [(= ?type "Product")]

Hi mentaloid

Thank you for this hint! I‘ll try this tomorrow.

Hi mentaloid

Your query works like charm, thanks!