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
@@ -371,6 +371,7 @@ public suspend fun SearchClient.chunkedBatch(
371
371
* @param indexName The index in which to perform the request.
372
372
* @param objects The list of objects to index.
373
373
* @param waitForTask If true, wait for the task to complete.
374
+
* @param batchSize The size of the batch. Default is 1000.
374
375
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
375
376
* @return The list of responses from the batch requests.
376
377
*
@@ -379,14 +380,15 @@ public suspend fun SearchClient.saveObjects(
379
380
indexName:String,
380
381
objects:List<JsonObject>,
381
382
waitForTask:Boolean = false,
383
+
batchSize:Int = 1000,
382
384
requestOptions:RequestOptions? = null,
383
385
): List<BatchResponse> {
384
386
returnthis.chunkedBatch(
385
387
indexName = indexName,
386
388
objects = objects,
387
389
action =Action.AddObject,
388
390
waitForTask = waitForTask,
389
-
batchSize =1000,
391
+
batchSize =batchSize,
390
392
requestOptions = requestOptions,
391
393
)
392
394
}
@@ -397,6 +399,7 @@ public suspend fun SearchClient.saveObjects(
397
399
* @param indexName The index in which to perform the request.
398
400
* @param objectIDs The list of objectIDs to delete from the index.
399
401
* @param waitForTask If true, wait for the task to complete.
402
+
* @param batchSize The size of the batch. Default is 1000.
400
403
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
401
404
* @return The list of responses from the batch requests.
402
405
*
@@ -405,14 +408,15 @@ public suspend fun SearchClient.deleteObjects(
405
408
indexName:String,
406
409
objectIDs:List<String>,
407
410
waitForTask:Boolean = false,
411
+
batchSize:Int = 1000,
408
412
requestOptions:RequestOptions? = null,
409
413
): List<BatchResponse> {
410
414
returnthis.chunkedBatch(
411
415
indexName = indexName,
412
416
objects = objectIDs.map { id ->JsonObject(mapOf("objectID" to Json.encodeToJsonElement(id))) },
413
417
action =Action.DeleteObject,
414
418
waitForTask = waitForTask,
415
-
batchSize =1000,
419
+
batchSize =batchSize,
416
420
requestOptions = requestOptions,
417
421
)
418
422
}
@@ -424,6 +428,7 @@ public suspend fun SearchClient.deleteObjects(
424
428
* @param objects The list of objects to update in the index.
425
429
* @param createIfNotExists To be provided if non-existing objects are passed, otherwise, the call will fail..
426
430
* @param waitForTask If true, wait for the task to complete.
431
+
* @param batchSize The size of the batch. Default is 1000.
427
432
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
428
433
* @return The list of responses from the batch requests.
429
434
*
@@ -433,14 +438,15 @@ public suspend fun SearchClient.partialUpdateObjects(
0 commit comments