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

[9.x] Re-query scout engine when paginate results contains insufficient keys to generate proper pagination count query #483

Merged
merged 1 commit into from
Jun 14, 2021

Conversation

crynobone
Copy link
Member

fixes #481

Signed-off-by: Mior Muhammad Zaki crynobone@gmail.com

to generate proper pagination count query.

fixes laravel#481

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
if (count($ids) < $totalCount) {
$ids = $engine->keys(tap(clone $this, function ($builder) use ($totalCount) {
$builder->take(
is_null($this->limit) ? $totalCount : min($this->limit, $totalCount)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting the limit will prevent Scout Driver/Engine from setting a default limit. e.g: Meilisearch has 20 records limit by default.

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

Successfully merging this pull request may close these issues.

[9.x] Pagination total messed up with query callback while eager loading
2 participants