Meilisearch-laravel-scout: Method Laravel\Scout\Builder::limit does not exist.

Created on 21 Apr 2020  ·  6Comments  ·  Source: meilisearch/meilisearch-laravel-scout

Hi,

It seems the limit() option is not available, if I read the documentation it seems it should be available.

$items = FaqItem::search(request('query'))->limit(5)->get();

Returns me with an error:

exception: "BadMethodCallException"
file: "/Users/***/Workspace/***/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php"
line: 103
message: "Method Laravel\Scout\Builder::limit does not exist."

Is there something I am missing, or is this method missing from the package?

Most helpful comment

You have right, my mistake take() is the correct one !
And to confirm yes the $builder->limit works has expected when using take()

I will update the doc ;)
Thank you!

All 6 comments

I think the documentation is wrong here. Correct would be the following:

$items = FaqItem::search(request('query'))->take(5)->get();

take() will work indeed, but does that make actual use of the limit function in the meilisearch API?

https://docs.meilisearch.com/guides/advanced_guides/search_parameters.html#limit

Yeah I have noticed that, then the documentation is indeed not correct I recon.

You have right, my mistake take() is the correct one !
And to confirm yes the $builder->limit works has expected when using take()

I will update the doc ;)
Thank you!

Keep up the awesome work 🚀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

curquiza picture curquiza  ·  17Comments

curquiza picture curquiza  ·  4Comments

dmyers picture dmyers  ·  14Comments

milosevicn picture milosevicn  ·  5Comments

dreamcog picture dreamcog  ·  14Comments