You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clients/algoliasearch-client-csharp/algoliasearch/Utils/SearchClientExtensions.cs
+21-16
Original file line number
Diff line number
Diff line change
@@ -166,35 +166,38 @@ public partial interface ISearchClient
166
166
/// </summary>
167
167
/// <param name="indexName">The index in which to perform the request.</param>
168
168
/// <param name="objects">The list of `objects` to store in the given Algolia `indexName`.</param>
169
+
/// <param name="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..</param>
169
170
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
170
171
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
178
179
/// </summary>
179
180
/// <param name="indexName">The index in which to perform the request.</param>
180
181
/// <param name="objectIDs">The list of `objectIDs` to remove from the given Algolia `indexName`.</param>
182
+
/// <param name="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..</param>
181
183
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
182
184
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// 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.
189
191
/// </summary>
190
192
/// <param name="indexName">The index in which to perform the request.</param>
191
193
/// <param name="objects">The list of `objects` to update in the given Algolia `indexName`.</param>
192
194
/// <param name="createIfNotExists">To be provided if non-existing objects are passed, otherwise, the call will fail.</param>
195
+
/// <param name="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..</param>
193
196
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
194
197
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
Copy file name to clipboardExpand all lines: clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/extensions/SearchClient.kt
+9-3
Original file line number
Diff line number
Diff line change
@@ -369,20 +369,22 @@ public suspend fun SearchClient.chunkedBatch(
369
369
*
370
370
* @param indexName The index in which to perform the request.
371
371
* @param objects The list of objects to index.
372
+
* @param waitForTask If true, wait for the task to complete.
372
373
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
373
374
* @return The list of responses from the batch requests.
374
375
*
375
376
*/
376
377
publicsuspendfun SearchClient.saveObjects(
377
378
indexName:String,
378
379
objects:List<JsonObject>,
380
+
waitForTask:Boolean = false,
379
381
requestOptions:RequestOptions? = null,
380
382
): List<BatchResponse> {
381
383
returnthis.chunkedBatch(
382
384
indexName = indexName,
383
385
objects = objects,
384
386
action =Action.AddObject,
385
-
waitForTask =false,
387
+
waitForTask =waitForTask,
386
388
batchSize =1000,
387
389
requestOptions = requestOptions,
388
390
)
@@ -393,20 +395,22 @@ public suspend fun SearchClient.saveObjects(
393
395
*
394
396
* @param indexName The index in which to perform the request.
395
397
* @param objectIDs The list of objectIDs to delete from the index.
398
+
* @param waitForTask If true, wait for the task to complete.
396
399
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
397
400
* @return The list of responses from the batch requests.
398
401
*
399
402
*/
400
403
publicsuspendfun SearchClient.deleteObjects(
401
404
indexName:String,
402
405
objectIDs:List<String>,
406
+
waitForTask:Boolean = false,
403
407
requestOptions:RequestOptions? = null,
404
408
): List<BatchResponse> {
405
409
returnthis.chunkedBatch(
406
410
indexName = indexName,
407
411
objects = objectIDs.map { id ->JsonObject(mapOf("objectID" to Json.encodeToJsonElement(id))) },
408
412
action =Action.DeleteObject,
409
-
waitForTask =false,
413
+
waitForTask =waitForTask,
410
414
batchSize =1000,
411
415
requestOptions = requestOptions,
412
416
)
@@ -418,6 +422,7 @@ public suspend fun SearchClient.deleteObjects(
418
422
* @param indexName The index in which to perform the request.
419
423
* @param objects The list of objects to update in the index.
420
424
* @param createIfNotExists To be provided if non-existing objects are passed, otherwise, the call will fail..
425
+
* @param waitForTask If true, wait for the task to complete.
421
426
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
422
427
* @return The list of responses from the batch requests.
423
428
*
@@ -426,13 +431,14 @@ public suspend fun SearchClient.partialUpdateObjects(
0 commit comments