Skip to content

Commit 66b3846

Browse files
committed
fix: java
1 parent d519757 commit 66b3846

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

templates/java/api_helpers.mustache

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,15 +735,34 @@ return partialUpdateObjects(indexName, objects, createIfNotExists, null);
735735
* @param indexName The `indexName` to update `objects` in.
736736
* @param objects The array of `objects` to update in the given Algolia `indexName`.
737737
* @param createIfNotExists To be provided if non-existing objects are passed, otherwise, the call will fail.
738+
* @param waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
739+
*/
740+
public <T> List<BatchResponse> partialUpdateObjects(
741+
String indexName,
742+
Iterable<T> objects,
743+
boolean createIfNotExists,
744+
boolean waitForTasks
745+
) {
746+
return partialUpdateObjects(indexName, objects, createIfNotExists, waitForTasks, null);
747+
}
748+
749+
/**
750+
* Helper: Replaces object content of all the given objects according to their respective `objectID` field. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
751+
*
752+
* @param indexName The `indexName` to update `objects` in.
753+
* @param objects The array of `objects` to update in the given Algolia `indexName`.
754+
* @param createIfNotExists To be provided if non-existing objects are passed, otherwise, the call will fail.
755+
* @param waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
738756
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions. (optional)
739757
*/
740758
public <T> List<BatchResponse> partialUpdateObjects(
741759
String indexName,
742760
Iterable<T> objects,
743761
boolean createIfNotExists,
762+
boolean waitForTasks,
744763
RequestOptions requestOptions
745764
) {
746-
return chunkedBatch(indexName, objects, createIfNotExists ? Action.PARTIAL_UPDATE_OBJECT : Action.PARTIAL_UPDATE_OBJECT_NO_CREATE, false, 1000, requestOptions);
765+
return chunkedBatch(indexName, objects, createIfNotExists ? Action.PARTIAL_UPDATE_OBJECT : Action.PARTIAL_UPDATE_OBJECT_NO_CREATE, waitForTasks, 1000, requestOptions);
747766
}
748767
749768
/**

0 commit comments

Comments
 (0)