Skip to content

Commit 32a9f09

Browse files
committed
Add pagination feature for v0.30.0
1 parent c54dbf0 commit 32a9f09

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/index/test_index_search_meilisearch.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,3 +413,26 @@ def test_custom_search_params_with_matching_strategy_last(index_with_documents):
413413

414414
assert isinstance(response, dict)
415415
assert len(response["hits"]) > 1
416+
417+
418+
def test_custom_search_params_with_pagination_parameters(index_with_documents):
419+
"""Tests search with matching strategy param set to last"""
420+
response = index_with_documents().search("", {"hitsPerPage": 1, "page": 1})
421+
422+
assert isinstance(response, dict)
423+
assert len(response["hits"]) == 1
424+
assert response["hitsPerPage"] == 1
425+
assert response["page"] == 1
426+
assert response["totalPages"] is not None
427+
assert response["totalHits"] is not None
428+
429+
def test_custom_search_params_with_pagination_parameters_at_zero(index_with_documents):
430+
"""Tests search with matching strategy param set to last"""
431+
response = index_with_documents().search("", {"hitsPerPage": 0, "page": 0})
432+
433+
assert isinstance(response, dict)
434+
assert len(response["hits"]) == 0
435+
assert response["hitsPerPage"] == 0
436+
assert response["page"] == 0
437+
assert response["totalPages"] is not None
438+
assert response["totalHits"] is not None

0 commit comments

Comments
 (0)