File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
# pylint: disable=invalid-name
2
2
3
+ from typing import Counter
4
+
3
5
import pytest
4
6
5
7
@@ -510,7 +512,9 @@ def test_vector_search(index_with_documents_and_vectors):
510
512
511
513
def test_search_distinct (index_with_documents ):
512
514
index_with_documents ().update_filterable_attributes (["genre" ])
513
- response = index_with_documents ().search ("How to train your dragin" , {"distinct" : "genre" })
515
+ response = index_with_documents ().search ("with" , {"distinct" : "genre" })
516
+ genres = dict (Counter ([x .get ("genre" ) for x in response ["hits" ]]))
514
517
assert isinstance (response , dict )
515
- assert len (response ["hits" ]) == 1
516
- assert response ["hits" ][0 ]["id" ] == "166428"
518
+ assert len (response ["hits" ]) == 11
519
+ assert genres == {None : 9 , "action" : 1 , "Sci Fi" : 1 }
520
+ assert response ["hits" ][0 ]["id" ] == "399579"
You can’t perform that action at this time.
0 commit comments