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

Pagination is broken #8

Open
sobrinho opened this issue Feb 1, 2024 · 0 comments
Open

Pagination is broken #8

sobrinho opened this issue Feb 1, 2024 · 0 comments

Comments

@sobrinho
Copy link

sobrinho commented Feb 1, 2024

Hi there!

x = MyIndex.search(...).per(20).page(1).load
x.first_page?
#=> true
x.last_page?
#=> FloatDomainError (Infinity)
x.total_pages
#=> FloatDomainError (Infinity)

That happens because:

      def total_pages
        (@results['found'] / @results['per_page'].to_f).ceil
      end

And it should be:

      def total_pages
        (@results['found'] / @results['request_params']['per_page'].to_f).ceil
      end
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

1 participant