-
Notifications
You must be signed in to change notification settings - Fork 53
Total hits incorrect when using pagination backend #138
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
Comments
Hi @Antsiscool thanks for reporting this bug! I'll be looking into it during this week, or if you want to, you can open a PR :) |
Hello @Antsiscool sorry for the huge delay This 200 fetch is currently expected to ensure we know the total number of matches, so know that total number of pages. Currently, there is no other way with Meilisearch (the core engine) to provide a "finite" pagination (e.g. being able to access another page other than the next one). Here is some resources regarding this
We know some of our users would love to use efficient finite pagination with Meilisearch and that's why we are currently thinking about adding this feature in a future version. Once it's implemented, the issue you raise will be definitely fixed! Thanks again for your report, and sorry for this! |
Hey @Antsiscool, this issue is fixed in the new version of Meilisearch v0.30! To use it, you must update your rails gem and your Meilisearch instance. If you use Check this #214 for more info regarding the implementation of finite pagination. Also: https://github.com/meilisearch/meilisearch-rails/releases/tag/v0.8.0 |
Description
When using a pagination backend, the total hits is capped at 200. I tried this with will_paginate, but it should also happen with kaminari.
When a pagination backend is set, the limit parameter is set to 200 with no option to override in MeiliSearch::Rails::ClassMethods#ms_search.
Later in the method total hits is calculated by total_hits = json['hits'].length. This is capped at 200 due to the limit set earlier.
total_hits should instead be set to the value of nbHits.
Expected behavior
When more than 200 documents match the search, the total hits count should be match the value returned.
What you expected to happen.
Current behavior
Currently the total number of hits is capped at 200.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: