Paginate only MAX records for searchkick #910
Replies: 4 comments 13 replies
-
|
Ok, so I guess that the pagy :count should be the min between the total_count and the max_result_window. Is it correct? |
Beta Was this translation helpful? Give feedback.
-
|
OK, so we need to change: By checking and: But I have no idea whether we can get it with Please advise. |
Beta Was this translation helpful? Give feedback.
-
|
OK, I checked and there is no way to get the |
Beta Was this translation helpful? Give feedback.
-
|
@JasonBarnabe For some reason, I receive your commit comments as email, but I cannot see them in the GitHub commit page. I see the comment bubble icon in the list of files, but no comment to be seen. 🤔 (It's painful to connect the email to the actual code) BTW, yes, the default is not properly handled, however it looks like your idea of dropping the pagy option won't work with passive mode, because Pagy has to know what was the max_result_window that generated the object, and the model is not there afaik, unless it would be accessible from the result object. Besides, in that case, we should go after all the possible way to get the result object in Searchkick AND in ElasticsearchRails and maybe we should apply restrictions on that. Bottom line: the easiest and unequivocal way to do it is asking the user to mirror the actual max_result_sindow value if that is not 10_000. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
https://ddnexus.github.io/pagy/guides/how-to/#paginate-only-max-records describes how to have a maximum number of paginatable records for performance reasons. This works for OFFSET and KEYSET paginators.
It would be useful for me to have a way to do this with the searchkick paginator as well. ElasticSearch has an option
max_result_windowwhich defines the number of records that can be loaded by search. It defaults to 10,000 records, but searchkick provides an option to have a different value. Currently, there are two issues when using pagy in relation tomax_result_window:max_result_window.max_result_windowis accessible from aSearchkick::Relationbysearch.model.searchkick_options[:max_result_window].Beta Was this translation helpful? Give feedback.
All reactions