Class IndexBatchException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.azure.core.exception.AzureException
com.azure.search.documents.models.IndexBatchException
- All Implemented Interfaces:
Serializable
public final class IndexBatchException
extends com.azure.core.exception.AzureException
An
IndexBatchException
is thrown whenever Azure Cognitive Search index call was only partially successful.
Users can inspect the indexingResults to determine the operation(s) that have failed.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindFailedActionsToRetry
(IndexBatchBase<SearchDocument> originalBatch, String keyFieldName) Finds all index actions in the given batch that failed and need to be retried, and returns them in a new batch.<T> IndexBatchBase<T>
findFailedActionsToRetry
(IndexBatchBase<T> originBatch, Function<T, String> keySelector) Finds all index actions in the given batch that failed and need to be retried, and returns them in a new batch.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
IndexBatchException
Constructs anIndexBatchException
from the givenIndexDocumentsResult
.- Parameters:
result
- The DocumentIndexResult returned from the service.
-
-
Method Details
-
findFailedActionsToRetry
public IndexBatchBase<SearchDocument> findFailedActionsToRetry(IndexBatchBase<SearchDocument> originalBatch, String keyFieldName) Finds all index actions in the given batch that failed and need to be retried, and returns them in a new batch.- Parameters:
originalBatch
- The batch that partially failed indexing.keyFieldName
- The name of the key field from the index schema.- Returns:
- A new batch containing all the actions from the given batch that failed and should be retried.
-
findFailedActionsToRetry
public <T> IndexBatchBase<T> findFailedActionsToRetry(IndexBatchBase<T> originBatch, Function<T, String> keySelector) Finds all index actions in the given batch that failed and need to be retried, and returns them in a new batch.- Type Parameters:
T
- The given document type.- Parameters:
originBatch
- The batch that partially failed indexing.keySelector
- A lambda that retrieves a key value from a given document of type T.- Returns:
- A new batch containing all the actions from the given batch that failed and should be retried.
-
getIndexingResults
- Returns:
- The indexing results returned by the service.
-