File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -1371,6 +1371,9 @@ async def get_documents(
13711371 "limit" : limit ,
13721372 }
13731373
1374+ if retrieve_vectors :
1375+ parameters ["retrieveVectors" ] = "true"
1376+
13741377 if not filter :
13751378 if fields :
13761379 parameters ["fields" ] = "," .join (fields )
@@ -1382,8 +1385,6 @@ async def get_documents(
13821385
13831386 if fields :
13841387 parameters ["fields" ] = fields
1385- if retrieve_vectors :
1386- parameters ["retrieveVectors" ] = retrieve_vectors
13871388
13881389 parameters ["filter" ] = filter
13891390
@@ -5577,6 +5578,9 @@ def get_documents(
55775578 "limit" : limit ,
55785579 }
55795580
5581+ if retrieve_vectors :
5582+ parameters ["retrieveVectors" ] = "true"
5583+
55805584 if not filter :
55815585 if fields :
55825586 parameters ["fields" ] = "," .join (fields )
@@ -5588,8 +5592,6 @@ def get_documents(
55885592
55895593 if fields :
55905594 parameters ["fields" ] = fields
5591- if retrieve_vectors :
5592- parameters ["retrieveVectors" ] = retrieve_vectors
55935595
55945596 parameters ["filter" ] = filter
55955597 response = self ._http_requests .post (f"{ self ._documents_url } /fetch" , body = parameters )
Original file line number Diff line number Diff line change @@ -758,6 +758,14 @@ async def test_get_documents_filter_with_fields(async_index_with_documents):
758758 assert next (iter (genres )) == "action"
759759
760760
761+ async def test_get_documents_with_vectors (async_index_with_documents ):
762+ index = await async_index_with_documents ()
763+ response = await index .update_filterable_attributes (["genre" ])
764+ await async_wait_for_task (index .http_client , response .task_uid )
765+ response = await index .get_documents (retrieve_vectors = True )
766+ assert all ("_vectors" in x .keys () for x in response .results )
767+
768+
761769@pytest .mark .parametrize ("compress" , (True , False ))
762770async def test_update_documents (compress , async_index_with_documents , small_movies ):
763771 index = await async_index_with_documents ()
Original file line number Diff line number Diff line change @@ -666,6 +666,14 @@ def test_get_documents_filter(index_with_documents):
666666 assert next (iter (genres )) == "action"
667667
668668
669+ def test_get_documents_with_vectors (index_with_documents ):
670+ index = index_with_documents ()
671+ response = index .update_filterable_attributes (["genre" ])
672+ wait_for_task (index .http_client , response .task_uid )
673+ response = index .get_documents (retrieve_vectors = True )
674+ assert all ("_vectors" in x .keys () for x in response .results )
675+
676+
669677def test_get_documents_filter_with_fields (index_with_documents ):
670678 index = index_with_documents ()
671679 response = index .update_filterable_attributes (["genre" ])
You can’t perform that action at this time.
0 commit comments