Skip to content

Total hits incorrect when using pagination backend #138

Closed
@Antsiscool

Description

@Antsiscool

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):

  • meilisearch-rails version: 0.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions