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-kotlin/client/src/commonMain/kotlin/com/algolia/client/extensions/SearchClient.kt
+9-3Lines changed: 9 additions & 3 deletions
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