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
AnIndexBatchException
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IndexBatchException(IndexDocumentsResult result)
Constructs anIndexBatchException
from the givenIndexDocumentsResult
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.<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.List<IndexingResult>
getIndexingResults()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
IndexBatchException
public IndexBatchException(IndexDocumentsResult result)
Constructs anIndexBatchException
from the givenIndexDocumentsResult
.- Parameters:
result
- The DocumentIndexResult returned from the service.
-
-
Method Detail
-
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
public List<IndexingResult> getIndexingResults()
- Returns:
- The indexing results returned by the service.
-
-