-
Notifications
You must be signed in to change notification settings - Fork 414
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
elasticsearch_rails ignores page_param #123
Comments
@0x0badc0de Thanks. However, I could give a shot at it if anyone (e.g. @Kani999, @0x0badc0de. @renshuki) that happen to use it could share a minimal rails app repo already configured with elasticsearch_rails working and a page showing the pagy output. |
@ddnexus here it is https://github.com/0x0badc0de/pagy-elasticsearch-demo let me know if it works for you. |
A setup with Docker Compose! That's great! |
The application by docker-compose run just fine. I cannot debug the offset issue (#118) because of this part of code https://github.com/0x0badc0de/pagy-elasticsearch-demo/blob/master/app/controllers/notes_controller.rb#L12 |
Ok I've run into the same error as in #118 - I've edit the index page, to load data by elasticsearch
def index
if params[:q].present?
@pagy, @notes = pagy_elasticsearch_rails(Note.search(params[:q]).records)
else
@pagy, @notes = pagy_elasticsearch_rails(Note.search('*').records)
end
end First page runs ok
The Second page have invalid offset so no records will be displayed
The Even the page does not change (reocrds id are the same) |
I didn't write that extra, so I don't know whether there is some mistake in the doc or it is just plain wrong. It uses the same logic of the Array extra, which assumes you already have the array of items, and you extract a page from it... which doesn't seem the way to go with ESrails :) Thanks for the extra editing. I will try it during the weekend. |
Fixed with the refactoring in branch v2.0-dev |
Compare https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/elasticsearch_rails.rb#L15
and https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/array.rb#L16 (or other backends)
The text was updated successfully, but these errors were encountered: