Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ search_parameter_guide_attributes_to_search_on_1: |-
client.index('movies').search('adventure', {
'attributesToSearchOn': ['overview']
})
distinct_attribute_guide_filterable_1: |-
client.index('products').update_filterable_attributes(['product_id', 'sku', 'url'])
distinct_attribute_guide_distinct_parameter_1: |-
client.index('products').search('white shirt', { distinct: 'sku' })
add_movies_json_1: |-
import json

Expand Down
8 changes: 8 additions & 0 deletions tests/index/test_index_search_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,11 @@ def test_vector_search(index_with_documents_and_vectors):
"", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}}
)
assert len(response["hits"]) > 0


def test_search_distinct(index_with_documents):
index_with_documents().update_filterable_attributes(["genre"])
response = index_with_documents().search("How to train your dragin", {"distinct": "genre"})
assert isinstance(response, dict)
assert len(response["hits"]) == 1
assert response["hits"][0]["id"] == "166428"