Filtering in nested results


(Nils Nilsson) #1

I'm quite new to this, but so far I love it. Here's the issue where I'm stuck at.

I have a type Product which has many colors.

I'm making a regular search for Product.name and the result might look like this

Product => [
'name' => 'The Product',
'Color' => [
[
'id' => 13,
'name' => 'Red'
],
[
'id' => 14,
'name' => 'Blue
]
]
]

However, sometimes I filter among the colors. So I only want blue products. Fair enough, I get the same result. However, I would like for the Color nest only to contain the blue object (or put it on top, whichever is less time consuming). So, removing all other colors leaving the array as below. Is this possible in a search query way?

Product => [
'name' => 'The Product',
'Color' => [
[
'id' => 14,
'name' => 'Blue
]
]
]


(system) closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.