Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Method Laravel\Scout\Builder::limit does not exist. #10

Closed
Cannonb4ll opened this issue Apr 21, 2020 · 6 comments
Closed

Method Laravel\Scout\Builder::limit does not exist. #10

Cannonb4ll opened this issue Apr 21, 2020 · 6 comments

Comments

@Cannonb4ll
Copy link
Contributor

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?

@SamuelNitsche
Copy link

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

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

@Cannonb4ll
Copy link
Contributor Author

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

@Cannonb4ll
Copy link
Contributor Author

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

@shokme
Copy link
Collaborator

shokme commented Apr 21, 2020

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!

@Cannonb4ll
Copy link
Contributor Author

Keep up the awesome work 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants