Skip to content

Commit e4993ab

Browse files
algolia-botFluf22millotpshortcuts
committed
feat(clients): add manual snippets for search doc (generated)
algolia/api-clients-automation#4388 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]> Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: shortcuts <[email protected]>
1 parent 0295191 commit e4993ab

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

client/src/commonMain/kotlin/com/algolia/client/extensions/SearchClient.kt

+14-14
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public suspend fun SearchClient.searchForFacets(
311311
* @param indexName The index in which to perform the request.
312312
* @param objects The list of objects to index.
313313
* @param action The action to perform on the objects. Default is `Action.AddObject`.
314-
* @param waitForTask If true, wait for the task to complete.
314+
* @param waitForTasks If true, wait for the task to complete.
315315
* @param batchSize The size of the batch. Default is 1000.
316316
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
317317
* @return The list of responses from the batch requests.
@@ -321,7 +321,7 @@ public suspend fun SearchClient.chunkedBatch(
321321
indexName: String,
322322
objects: List<JsonObject>,
323323
action: Action = Action.AddObject,
324-
waitForTask: Boolean,
324+
waitForTasks: Boolean,
325325
batchSize: Int = 1000,
326326
requestOptions: RequestOptions? = null,
327327
): List<BatchResponse> {
@@ -340,7 +340,7 @@ public suspend fun SearchClient.chunkedBatch(
340340
)
341341
tasks.add(batch)
342342
}
343-
if (waitForTask) {
343+
if (waitForTasks) {
344344
tasks.forEach { waitForTask(indexName, it.taskID) }
345345
}
346346
return tasks
@@ -351,7 +351,7 @@ public suspend fun SearchClient.chunkedBatch(
351351
*
352352
* @param indexName The index in which to perform the request.
353353
* @param objects The list of objects to index.
354-
* @param waitForTask If true, wait for the task to complete.
354+
* @param waitForTasks If true, wait for the task to complete.
355355
* @param batchSize The size of the batch. Default is 1000.
356356
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
357357
* @return The list of responses from the batch requests.
@@ -360,24 +360,24 @@ public suspend fun SearchClient.chunkedBatch(
360360
public suspend fun SearchClient.saveObjects(
361361
indexName: String,
362362
objects: List<JsonObject>,
363-
waitForTask: Boolean = false,
363+
waitForTasks: Boolean = false,
364364
batchSize: Int = 1000,
365365
requestOptions: RequestOptions? = null,
366366
): List<BatchResponse> = this.chunkedBatch(
367367
indexName = indexName,
368368
objects = objects,
369369
action = Action.AddObject,
370-
waitForTask = waitForTask,
370+
waitForTasks = waitForTasks,
371371
batchSize = batchSize,
372372
requestOptions = requestOptions,
373373
)
374374

375375
/**
376-
* 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.
376+
* Helper: Deletes every record for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
377377
*
378378
* @param indexName The index in which to perform the request.
379379
* @param objectIDs The list of objectIDs to delete from the index.
380-
* @param waitForTask If true, wait for the task to complete.
380+
* @param waitForTasks If true, wait for the task to complete.
381381
* @param batchSize The size of the batch. Default is 1000.
382382
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
383383
* @return The list of responses from the batch requests.
@@ -386,14 +386,14 @@ public suspend fun SearchClient.saveObjects(
386386
public suspend fun SearchClient.deleteObjects(
387387
indexName: String,
388388
objectIDs: List<String>,
389-
waitForTask: Boolean = false,
389+
waitForTasks: Boolean = false,
390390
batchSize: Int = 1000,
391391
requestOptions: RequestOptions? = null,
392392
): List<BatchResponse> = this.chunkedBatch(
393393
indexName = indexName,
394394
objects = objectIDs.map { id -> JsonObject(mapOf("objectID" to Json.encodeToJsonElement(id))) },
395395
action = Action.DeleteObject,
396-
waitForTask = waitForTask,
396+
waitForTasks = waitForTasks,
397397
batchSize = batchSize,
398398
requestOptions = requestOptions,
399399
)
@@ -404,7 +404,7 @@ public suspend fun SearchClient.deleteObjects(
404404
* @param indexName The index in which to perform the request.
405405
* @param objects The list of objects to update in the index.
406406
* @param createIfNotExists To be provided if non-existing objects are passed, otherwise, the call will fail..
407-
* @param waitForTask If true, wait for the task to complete.
407+
* @param waitForTasks If true, wait for the task to complete.
408408
* @param batchSize The size of the batch. Default is 1000.
409409
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
410410
* @return The list of responses from the batch requests.
@@ -414,14 +414,14 @@ public suspend fun SearchClient.partialUpdateObjects(
414414
indexName: String,
415415
objects: List<JsonObject>,
416416
createIfNotExists: Boolean,
417-
waitForTask: Boolean = false,
417+
waitForTasks: Boolean = false,
418418
batchSize: Int = 1000,
419419
requestOptions: RequestOptions? = null,
420420
): List<BatchResponse> = this.chunkedBatch(
421421
indexName = indexName,
422422
objects = objects,
423423
action = if (createIfNotExists) Action.PartialUpdateObject else Action.PartialUpdateObjectNoCreate,
424-
waitForTask = waitForTask,
424+
waitForTasks = waitForTasks,
425425
batchSize = batchSize,
426426
requestOptions = requestOptions,
427427
)
@@ -464,7 +464,7 @@ public suspend fun SearchClient.replaceAllObjects(
464464
indexName = tmpIndexName,
465465
objects = objects,
466466
action = Action.AddObject,
467-
waitForTask = true,
467+
waitForTasks = true,
468468
batchSize = batchSize,
469469
requestOptions = requestOptions,
470470
)

0 commit comments

Comments
 (0)