Skip to content

Commit b9be54d

Browse files
authored
Search fix 40157 (#41066)
* Fix batch indexing. * update changelog * updates
1 parent 95b6c31 commit b9be54d

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

sdk/search/azure-search-documents/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
- `azure.search.documents.indexes.models.RankingOrder`
3939
- `azure.search.documents.indexes.models.SearchIndexPermissionFilterOption`
4040

41+
### Bugs Fixed
42+
43+
- Fixed the issue batching in upload_documents() did not work. #40157
44+
4145
### Other Changes
4246

4347
- Updated the API version to "2025-05-01-preview"

sdk/search/azure-search-documents/azure/search/documents/_search_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def _index_documents_actions(self, actions: List[IndexAction], **kwargs: Any) ->
706706
kwargs["headers"] = self._merge_client_headers(kwargs.get("headers"))
707707
batch = IndexBatch(actions=actions)
708708
try:
709-
batch_response = self._client.documents.index(batch=batch, **kwargs)
709+
batch_response = self._client.documents.index(batch=batch, error_map=error_map, **kwargs)
710710
return cast(List[IndexingResult], batch_response.results)
711711
except RequestEntityTooLargeError:
712712
if len(actions) == 1:
@@ -718,7 +718,7 @@ def _index_documents_actions(self, actions: List[IndexAction], **kwargs: Any) ->
718718
else:
719719
result_first_half = []
720720
batch_response_second_half = self._index_documents_actions(
721-
actions=actions[pos:], error_map=error_map, **kwargs
721+
actions=actions[pos:], **kwargs
722722
)
723723
if batch_response_second_half:
724724
result_second_half = batch_response_second_half

sdk/search/azure-search-documents/azure/search/documents/_search_indexing_buffered_sender.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def _index_documents_actions(self, actions: List[IndexAction], **kwargs) -> List
296296
if remaining < 0:
297297
raise ServiceResponseTimeoutError("Service response time out") from ex
298298
batch_response_first_half = self._index_documents_actions(
299-
actions=actions[:pos], error_map=error_map, timeout=remaining, **kwargs
299+
actions=actions[:pos], timeout=remaining, **kwargs
300300
)
301301
if len(batch_response_first_half) > 0:
302302
result_first_half = batch_response_first_half
@@ -307,7 +307,7 @@ def _index_documents_actions(self, actions: List[IndexAction], **kwargs) -> List
307307
if remaining < 0:
308308
raise ServiceResponseTimeoutError("Service response time out") from ex
309309
batch_response_second_half = self._index_documents_actions(
310-
actions=actions[pos:], error_map=error_map, timeout=remaining, **kwargs
310+
actions=actions[pos:], timeout=remaining, **kwargs
311311
)
312312
if len(batch_response_second_half) > 0:
313313
result_second_half = batch_response_second_half

sdk/search/azure-search-documents/azure/search/documents/aio/_search_indexing_buffered_sender_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ async def _index_documents_actions(self, actions: List[IndexAction], **kwargs: A
299299
if remaining < 0:
300300
raise ServiceResponseTimeoutError("Service response time out") from ex
301301
batch_response_first_half = await self._index_documents_actions(
302-
actions=actions[:pos], error_map=error_map, **kwargs
302+
actions=actions[:pos], timeout=remaining, **kwargs
303303
)
304304
if len(batch_response_first_half) > 0:
305305
result_first_half = batch_response_first_half
@@ -310,7 +310,7 @@ async def _index_documents_actions(self, actions: List[IndexAction], **kwargs: A
310310
if remaining < 0:
311311
raise ServiceResponseTimeoutError("Service response time out") from ex
312312
batch_response_second_half = await self._index_documents_actions(
313-
actions=actions[pos:], error_map=error_map, **kwargs
313+
actions=actions[pos:], timeout=remaining, **kwargs
314314
)
315315
if len(batch_response_second_half) > 0:
316316
result_second_half = batch_response_second_half

0 commit comments

Comments
 (0)