Skip to content

Add pagination handler using finite pagination #214

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

Conversation

brunoocasali
Copy link
Member

@brunoocasali brunoocasali commented Nov 16, 2022

The change was more straightforward than I expected. I removed the placeholder search and mapped the response from the Meilisearch server. Also, I ensure we will always have a page = 1 when we have a pagination_backend set.

All the tests passed locally (by using meilisearch-ruby with the v0.30 changes). So I can assume, based on our coverage, we are good to go.

  • Test how pagy will react to those changes

@brunoocasali brunoocasali added the breaking-change The related changes are breaking for the users label Nov 16, 2022
@brunoocasali
Copy link
Member Author

I put the PR in draft mode because I need to release the ruby. But you're welcome to review :)

@@ -35,7 +35,7 @@ def create(results, total_hits, options = {})
if array.empty? && !results.empty?
# since Kaminari 0.16.0, you need to pad the results with nil values so it matches the offset param
# otherwise you'll get an empty array: https://github.com/amatsuda/kaminari/commit/29fdcfa8865f2021f710adaedb41b7a7b081e34d
results = ([nil] * offset) + results
results = Array.new(offset) + results
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a cosmetic change 💅

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also positively surprised by the small changes needed!

Either we have a nice codebase, or we have missed something. I vote for the first option 😎

A detail: the comment line 625 is outdated, I guess

@brunoocasali brunoocasali marked this pull request as ready for review November 28, 2022 19:55
@brunoocasali brunoocasali merged commit 6d50205 into bump-meilisearch-v0.30.0 Nov 28, 2022
@brunoocasali brunoocasali deleted the bump-meilisearch-v0.30.0-add-limited-pagination branch November 28, 2022 19:55
@brunoocasali brunoocasali mentioned this pull request Nov 28, 2022
bors bot added a commit that referenced this pull request Dec 1, 2022
217: Release v0.8.0 r=brunoocasali a=brunoocasali

This version makes this package compatible with Meilisearch v0.30.0 🎉
Check out the changelog of [Meilisearch v0.30.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.30.0) for more information on the changes.

## ⚠️ Breaking changes

This release is **only** compatible with the latest version of [Meilisearch v0.30.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.30.0) and greater

* Rename meilisearch_host to meilisearch_url (#197) `@AdoPi`

## 🚀 Enhancements

* Add the ability to define `pagination` settings in the model directly. (#208) `@yagince`
* Use **finite pagination** strategy when `pagination_backend` is defined. (#214) `@brunoocasali` 
  Read more about it [here](meilisearch/specifications#196)
 
Thanks again to `@AdoPi,`  `@brunoocasali,` `@curquiza,` and `@yagince!` 🎉



Co-authored-by: Bruno Casali <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants