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

Incorrect Total Count in Laravel Scout Pagination #824

Open
Evenerik opened this issue Apr 25, 2024 · 9 comments
Open

Incorrect Total Count in Laravel Scout Pagination #824

Evenerik opened this issue Apr 25, 2024 · 9 comments

Comments

@Evenerik
Copy link

Scout Version

10.8.6

Scout Driver

Typesense

Laravel Version

10.48.3

PHP Version

8.3.0

Database Driver & Version

MySQL 8.0.36

SDK Version

No response

Meilisearch CLI Version

No response

Description

This is pretty much a reopening of @razvaniacob's issue, who has encountered the same problem I am currently facing. I won't go into too much detail since he described the bug perfectly well in his issue, but Scout's LengthAwarePaginator shows wrong total when using Typesense's engine

Steps To Reproduce

See steps in #819

@driesvints
Copy link
Member

@karakhanyans do you have any thoughts here?

@karakhanyans
Copy link
Contributor

@driesvints will check this and get back with more info 👌

@razvaniacob
Copy link

I will be happy to see this solved guys. Good luck!

@driesvints
Copy link
Member

@karakhanyans any news here?

@AbdullahFaqeir
Copy link
Contributor

I'll be working on this

@tamakoma1129
Copy link

Hello,

I encountered the same issue reported here. In my case, I was using a model with a ULID as the primary key but initially forgot to set protected $keyType = 'string'; in my model. After updating this setting, I can confirm that the pagination now works correctly.

Here are the specifics of my development environment:

  • Laravel Version: 10.48.4
  • Scout Version: 10.8.6
  • PHP Version: 8.1.27
  • Scout Driver: Meilisearch
  • Database: MySQL 8.0.36

Apologies if this solution has already been mentioned. I hope this helps someone else experiencing the same problem.

Thank you.

@driesvints
Copy link
Member

Ping @jasonbosco

@jasonbosco
Copy link
Contributor

@AbdullahFaqeir will be working on this going forward.

@AbdullahFaqeir
Copy link
Contributor

Hi @Evenerik!

Can you please dump the collection schema, and sample record in typesense and the same record in database.

Below you can see a dump of my env showing a working fresh sample, I've seeded 10K users.

User model settings.

screenshot 7

Search performed.

screenshot 8

Paginated search results.

screenshot 6

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

No branches or pull requests

7 participants