Skip to content

Commit b5a2eea

Browse files
committed
adds integration test case for distinct
1 parent 3bba555 commit b5a2eea

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.code-samples.meilisearch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ search_parameter_guide_attributes_to_search_on_1: |-
373373
'attributesToSearchOn': ['overview']
374374
})
375375
distinct_attribute_guide_filterable_1: |-
376-
client.index('products').updateFilterableAttributes(['product_id', 'sku', 'url'])
376+
client.index('products').update_filterable_attributes(['product_id', 'sku', 'url'])
377377
distinct_attribute_guide_distinct_parameter_1: |-
378378
client.index('products').search('white shirt', { distinct: 'sku' })
379379
add_movies_json_1: |-

tests/index/test_index_search_meilisearch.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,11 @@ def test_vector_search(index_with_documents_and_vectors):
506506
"", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}}
507507
)
508508
assert len(response["hits"]) > 0
509+
510+
511+
def test_search_distinct(index_with_documents):
512+
index_with_documents().update_filterable_attributes(["genre"])
513+
response = index_with_documents().search("How to train your dragin", {"distinct": "genre"})
514+
assert isinstance(response, dict)
515+
assert len(response["hits"]) == 1
516+
assert response["hits"][0]["id"] == "166428"

0 commit comments

Comments
 (0)