Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search results limiting still returning all results #594

Closed
samfrjn11 opened this issue Feb 21, 2022 · 2 comments
Closed

Search results limiting still returning all results #594

samfrjn11 opened this issue Feb 21, 2022 · 2 comments

Comments

@samfrjn11
Copy link

samfrjn11 commented Feb 21, 2022

  • Scout Version: 9.4.4
  • Scout Driver: Database
  • Laravel Version: 9.1.0
  • PHP Version: 8.1.2
  • Database Driver & Version: MySQL 8.0.28

Description:

Support for limiting results on the CollectionEngine was added in #569 but the collection still returns all results when ->take(i) is used.
The application is not throwing an error when using the ->take() method, but it's not adding the limit and offset parameters to the SQL query either.

Steps To Reproduce:

  • Create a model with Searchable trait
  • SearchableModel::search($value)->take(5)->get();
@driesvints
Copy link
Member

Ping @keithbrink, do you have any ideas here?

@driesvints
Copy link
Member

I just noticed you're using the database driver but reporting on the collection engine. It seems this isn't implemented yet on the database engine: https://github.com/laravel/scout/blob/9.x/src/Engines/DatabaseEngine.php#L56

Feel free to send in a PR if you want 👍

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

No branches or pull requests

3 participants