Skip to content

Commit

Permalink
Add pagination feature for v0.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alallema committed Nov 17, 2022
1 parent c54dbf0 commit 32a9f09
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/index/test_index_search_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,26 @@ def test_custom_search_params_with_matching_strategy_last(index_with_documents):

assert isinstance(response, dict)
assert len(response["hits"]) > 1


def test_custom_search_params_with_pagination_parameters(index_with_documents):
"""Tests search with matching strategy param set to last"""
response = index_with_documents().search("", {"hitsPerPage": 1, "page": 1})

assert isinstance(response, dict)
assert len(response["hits"]) == 1
assert response["hitsPerPage"] == 1
assert response["page"] == 1
assert response["totalPages"] is not None
assert response["totalHits"] is not None

def test_custom_search_params_with_pagination_parameters_at_zero(index_with_documents):
"""Tests search with matching strategy param set to last"""
response = index_with_documents().search("", {"hitsPerPage": 0, "page": 0})

assert isinstance(response, dict)
assert len(response["hits"]) == 0
assert response["hitsPerPage"] == 0
assert response["page"] == 0
assert response["totalPages"] is not None
assert response["totalHits"] is not None

0 comments on commit 32a9f09

Please sign in to comment.