1

When I try to use a where clause after the search method I get this:

Error

That's my Product model: Product model

I've tried two methods to get the products of a specific store_id:

This one and this one (sorry for not using the code formatting I'm too dumb for that)

Any ideas about what I'm doing wrong?

I'm using PHP 8.0.10, Arch Linux, Meilisearch 0.22.0, Laravel 8.4, Laravel Scout 9.2 and meilisearch-php 0.19.1.

Thanks in advance.

  • 2
    Hi! The error explains you have to add the attribute you want to filter by to the filterableAttributes in the MeiliSearch settings: https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html – CaroFG Sep 22 '21 at 12:48
  • 1
    Oh thanks, just in case someone needs it, I decided to make a command (meilisearch:update) and your handle function looks like this: $client = new Client(config('scout.meilisearch.host')); $client->index('products')->updateFilterableAttributes(['id', 'name', 'sku', 'store_id']); – Pedro Abreu Sep 22 '21 at 13:04

0 Answers0