0

I have a transaction model, and other related models. While indexing in meili I eager load relations in transaction model and add a new key and relation, so in meili it shows a key and JSON data.

I thought calling ::search on model will fetch data from meili and return, but scout seems to fetch just model id and calling database with IN operator to fetch models.

For complex models I don't want to hit database and just fetch whole object from meili. How is this possible? I couldn't find it in scout documentation.

shyammakwana.me
  • 5,562
  • 2
  • 29
  • 50
  • _Finally, add the Laravel\Scout\Searchable trait to the model you would like to make searchable. This trait will register a model observer that will automatically keep the model in sync with your search driver_ Is this done? – linktoahref Jul 14 '23 at 07:26
  • Ofcourse that trait is there and I'm getting data as well. But my point is that database is hitting, that I want to skip. I want to return whole meili object without Laravel going to database for that model and fetching data from there. – shyammakwana.me Jul 14 '23 at 08:09
  • Have you looked into [meilisearch-php](https://github.com/meilisearch/meilisearch-php)? The [search method](https://github.com/meilisearch/meilisearch-php/wiki/Search) might be what you are looking for... – CaroFG Jul 17 '23 at 08:20
  • yes I'm using `search` method only. But still I see queries in `clockwork` (using `IN` keyword). – shyammakwana.me Jul 17 '23 at 10:11

0 Answers0