Dominic
02/12/2025, 10:26 AMproducts
with the columns category_1_id
, category_2_id
, category_3_id
. Inside the document I set the reference like that (Laravel Scout)
['name' => 'category_1_id ', 'type' => 'string', 'reference' => 'categories.id'],
['name' => 'category_2_id', 'type' => 'string', 'reference' => 'categories.id'],
['name' => 'category_3_id', 'type' => 'string', 'reference' => 'categories.id'],
inside my search statement I now try to include all categories. However it only includes the first:
include_fields: $products(*, $categories(*, strategy: nest_array))
what am I missing? I'm also using a filter_by:
(id: * || $products(price:=100))
Thanks in advance!Dominic
02/12/2025, 12:29 PMJason Bosco
02/13/2025, 3:11 AMHarpreet Sangar
02/13/2025, 6:08 AMHarpreet Sangar
02/13/2025, 6:43 AM'name' => 'categories', 'type' => 'string[]', 'reference' => 'categories.id'
containing all the categories.
• You can add intermediary collections like:
products -> category_1 -> categories
products -> category_2 -> categories
products -> category_3 -> categories
Now you'll be able to do include_fields: $products(*, $category_1($categories(*, strategy: merge)), $category_2($categories(*, strategy: merge)), ...)