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-16Lines changed: 21 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -167,24 +167,26 @@ public partial interface ISearchClient
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
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>
170
+
/// <param name="batchSize">The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.</param>
170
171
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
171
172
/// <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.
179
180
/// </summary>
180
181
/// <param name="indexName">The index in which to perform the request.</param>
181
182
/// <param name="objectIDs">The list of `objectIDs` to remove from the given Algolia `indexName`.</param>
182
183
/// <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>
184
+
/// <param name="batchSize">The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.</param>
183
185
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
184
186
/// <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.
@@ -193,11 +195,12 @@ public partial interface ISearchClient
193
195
/// <param name="objects">The list of `objects` to update in the given Algolia `indexName`.</param>
194
196
/// <param name="createIfNotExists">To be provided if non-existing objects are passed, otherwise, the call will fail.</param>
195
197
/// <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>
198
+
/// <param name="batchSize">The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.</param>
196
199
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
197
200
/// <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-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