Blueprint query field from multiple pages

I am using a multiselect field with a query option like so:
query: site.index.filterBy('template', 'in', ['questions-category']).first.customaccordion.toStructure

And this is fine, but my problem is there are multiple pages with that template. Is there a way to query the field from all pages (so not use first, but foreach) ?

Follow up:
If i first have a pages field called somepage, can i use the query in the example above to fetch the field from that page only? eg page.somepage.customaccordion.toStructure but not page.somepage but ‘this block’.somepage

First question: Yes, but you would have to get all items via a custom method (or a route), then query that method.

Block question: How do you determine which block should be used?

So for the first question, no native foreach exists in the query language?

Second q: The blocks are custom made and are stored inside of the block field (type block). So when I choose the custom block, there should be two fields - selected page and selected page field values. So structure is:

  • block 1
  • block 2

I would need the block 2 value to fetch values from block 1 selected page. So something like query: page.block.block1.toPage.customaccordion.toStructure

No, the query language is not a programming language, so no, no control structures