Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions meilisearch_python_sdk/models/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class SearchResults(CamelBase, Generic[T]):
processing_time_ms: int
query: str
facet_distribution: JsonDict | None = None
facet_stats: JsonDict | None = None
total_pages: int | None = None
total_hits: int | None = None
page: int | None = None
Expand All @@ -109,6 +110,7 @@ class SearchResultsFederated(CamelBase, Generic[T]):
estimated_total_hits: int | None = None
processing_time_ms: int
facet_distribution: JsonDict | None = None
facet_stats: JsonDict | None = None
total_pages: int | None = None
total_hits: int | None = None
page: int | None = None
Expand Down
5 changes: 5 additions & 0 deletions tests/test_async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ async def test_custom_search_params_with_facets(async_index_with_documents):
assert response.facet_distribution["genre"]["cartoon"] == 1
assert response.facet_distribution["genre"]["action"] == 3
assert response.facet_distribution["genre"]["fantasy"] == 1
assert response.facet_stats is not None


async def test_custom_search_params_with_facet_filters(async_index_with_documents):
Expand All @@ -166,6 +167,7 @@ async def test_custom_search_params_with_facet_filters(async_index_with_document
response = await index.search("world", filter=[["genre = action"]])
assert len(response.hits) == 3
assert response.facet_distribution is None
assert response.facet_stats is None


async def test_custom_search_params_with_multiple_facet_filters(async_index_with_documents):
Expand All @@ -177,6 +179,7 @@ async def test_custom_search_params_with_multiple_facet_filters(async_index_with
)
assert len(response.hits) == 3
assert response.facet_distribution is None
assert response.facet_stats is None


async def test_custom_search_facet_filters_with_space(async_client):
Expand Down Expand Up @@ -262,6 +265,7 @@ async def test_custom_search_params_with_many_params(async_index_with_documents)
)
assert len(response.hits) == 3
assert response.facet_distribution is None
assert response.facet_stats is None
assert "title" in response.hits[0]
assert "poster" in response.hits[0]
assert "overview" not in response.hits[0]
Expand Down Expand Up @@ -472,6 +476,7 @@ async def test_multi_search_federated_merge_facets(
assert "_federation" in response.hits[0]
assert response.facets_by_index is None
assert response.facet_distribution is not None
assert response.facet_stats is not None


async def test_multi_search_locales(async_client, async_index_with_documents, async_empty_index):
Expand Down
5 changes: 5 additions & 0 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def test_custom_search_params_with_facets(index_with_documents):
assert response.facet_distribution["genre"]["cartoon"] == 1
assert response.facet_distribution["genre"]["action"] == 3
assert response.facet_distribution["genre"]["fantasy"] == 1
assert response.facet_stats is not None


def test_custom_search_params_with_facet_filters(index_with_documents):
Expand All @@ -166,6 +167,7 @@ def test_custom_search_params_with_facet_filters(index_with_documents):
response = index.search("world", filter=[["genre = action"]])
assert len(response.hits) == 3
assert response.facet_distribution is None
assert response.facet_stats is None


def test_custom_search_params_with_multiple_facet_filters(index_with_documents):
Expand All @@ -177,6 +179,7 @@ def test_custom_search_params_with_multiple_facet_filters(index_with_documents):
)
assert len(response.hits) == 3
assert response.facet_distribution is None
assert response.facet_stats is None


def test_custom_search_facet_filters_with_space(client):
Expand Down Expand Up @@ -262,6 +265,7 @@ def test_custom_search_params_with_many_params(index_with_documents):
)
assert len(response.hits) == 3
assert response.facet_distribution is None
assert response.facet_stats is None
assert "title" in response.hits[0]
assert "poster" in response.hits[0]
assert "overview" not in response.hits[0]
Expand Down Expand Up @@ -445,6 +449,7 @@ def test_multi_search_federated_merge_facets(
assert "_federation" in response.hits[0]
assert response.facets_by_index is None
assert response.facet_distribution is not None
assert response.facet_stats is not None


def test_multi_search_locales(client, index_with_documents, empty_index):
Expand Down