Skip to content

Commit aff94b1

Browse files
chore: specs (generated)
Co-authored-by: shortcuts <[email protected]>
1 parent ba1a018 commit aff94b1

File tree

15 files changed

+174
-38
lines changed

15 files changed

+174
-38
lines changed

clients/algoliasearch-client-go/algolia/abtesting/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-go/algolia/analytics/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-go/algolia/ingestion/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-go/algolia/insights/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-go/algolia/monitoring/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-go/algolia/personalization/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-go/algolia/query-suggestions/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-go/algolia/recommend/client.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/SearchClient.java

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6612,7 +6612,31 @@ public <T> List<BatchResponse> saveObjects(String indexName, Iterable<T> objects
66126612
* the transporter requestOptions. (optional)
66136613
*/
66146614
public <T> List<BatchResponse> saveObjects(String indexName, Iterable<T> objects, boolean waitForTasks, RequestOptions requestOptions) {
6615-
return chunkedBatch(indexName, objects, Action.ADD_OBJECT, waitForTasks, 1000, requestOptions);
6615+
return saveObjects(indexName, objects, false, 1000, requestOptions);
6616+
}
6617+
6618+
/**
6619+
* Helper: Saves the given array of objects in the given index. The `chunkedBatch` helper is used
6620+
* under the hood, which creates a `batch` requests with at most 1000 objects in it.
6621+
*
6622+
* @param indexName The `indexName` to replace `objects` in.
6623+
* @param objects The array of `objects` to store in the given Algolia `indexName`.
6624+
* @param waitForTasks - Whether or not we should wait until every `batch` tasks has been
6625+
* processed, this operation may slow the total execution time of this method but is more
6626+
* reliable.
6627+
* @param batchSize The size of the chunk of `objects`. The number of `batch` calls will be equal
6628+
* to `length(objects) / batchSize`.
6629+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
6630+
* the transporter requestOptions. (optional)
6631+
*/
6632+
public <T> List<BatchResponse> saveObjects(
6633+
String indexName,
6634+
Iterable<T> objects,
6635+
boolean waitForTasks,
6636+
int batchSize,
6637+
RequestOptions requestOptions
6638+
) {
6639+
return chunkedBatch(indexName, objects, Action.ADD_OBJECT, waitForTasks, batchSize, requestOptions);
66166640
}
66176641

66186642
/**
@@ -6652,6 +6676,30 @@ public List<BatchResponse> deleteObjects(String indexName, List<String> objectID
66526676
* the transporter requestOptions. (optional)
66536677
*/
66546678
public List<BatchResponse> deleteObjects(String indexName, List<String> objectIDs, boolean waitForTasks, RequestOptions requestOptions) {
6679+
return deleteObjects(indexName, objectIDs, false, 1000, null);
6680+
}
6681+
6682+
/**
6683+
* Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under
6684+
* the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
6685+
*
6686+
* @param indexName The `indexName` to delete `objectIDs` from.
6687+
* @param objectIDs The array of `objectIDs` to delete from the `indexName`.
6688+
* @param waitForTasks - Whether or not we should wait until every `batch` tasks has been
6689+
* processed, this operation may slow the total execution time of this method but is more
6690+
* reliable.
6691+
* @param batchSize The size of the chunk of `objects`. The number of `batch` calls will be equal
6692+
* to `length(objects) / batchSize`.
6693+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
6694+
* the transporter requestOptions. (optional)
6695+
*/
6696+
public List<BatchResponse> deleteObjects(
6697+
String indexName,
6698+
List<String> objectIDs,
6699+
boolean waitForTasks,
6700+
int batchSize,
6701+
RequestOptions requestOptions
6702+
) {
66556703
List<Map<String, String>> objects = new ArrayList<>();
66566704

66576705
for (String id : objectIDs) {
@@ -6660,7 +6708,7 @@ public List<BatchResponse> deleteObjects(String indexName, List<String> objectID
66606708
objects.add(obj);
66616709
}
66626710

6663-
return chunkedBatch(indexName, objects, Action.DELETE_OBJECT, waitForTasks, 1000, requestOptions);
6711+
return chunkedBatch(indexName, objects, Action.DELETE_OBJECT, waitForTasks, batchSize, requestOptions);
66646712
}
66656713

66666714
/**
@@ -6720,13 +6768,41 @@ public <T> List<BatchResponse> partialUpdateObjects(
67206768
boolean createIfNotExists,
67216769
boolean waitForTasks,
67226770
RequestOptions requestOptions
6771+
) {
6772+
return partialUpdateObjects(indexName, objects, createIfNotExists, waitForTasks, 1000, null);
6773+
}
6774+
6775+
/**
6776+
* Helper: Replaces object content of all the given objects according to their respective
6777+
* `objectID` field. The `chunkedBatch` helper is used under the hood, which creates a `batch`
6778+
* requests with at most 1000 objects in it.
6779+
*
6780+
* @param indexName The `indexName` to update `objects` in.
6781+
* @param objects The array of `objects` to update in the given Algolia `indexName`.
6782+
* @param createIfNotExists To be provided if non-existing objects are passed, otherwise, the call
6783+
* will fail.
6784+
* @param waitForTasks - Whether or not we should wait until every `batch` tasks has been
6785+
* processed, this operation may slow the total execution time of this method but is more
6786+
* reliable.
6787+
* @param batchSize The size of the chunk of `objects`. The number of `batch` calls will be equal
6788+
* to `length(objects) / batchSize`.
6789+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
6790+
* the transporter requestOptions. (optional)
6791+
*/
6792+
public <T> List<BatchResponse> partialUpdateObjects(
6793+
String indexName,
6794+
Iterable<T> objects,
6795+
boolean createIfNotExists,
6796+
boolean waitForTasks,
6797+
int batchSize,
6798+
RequestOptions requestOptions
67236799
) {
67246800
return chunkedBatch(
67256801
indexName,
67266802
objects,
67276803
createIfNotExists ? Action.PARTIAL_UPDATE_OBJECT : Action.PARTIAL_UPDATE_OBJECT_NO_CREATE,
67286804
waitForTasks,
6729-
1000,
6805+
batchSize,
67306806
requestOptions
67316807
);
67326808
}

clients/algoliasearch-client-javascript/packages/client-search/model/clientMethodProps.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,21 +824,24 @@ export type SearchClientNodeHelpers = {
824824
getSecuredApiKeyRemainingValidity: (opts: GetSecuredApiKeyRemainingValidityOptions) => number;
825825
};
826826

827-
export type DeleteObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'waitForTasks'> & {
827+
export type DeleteObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'waitForTasks' | 'batchSize'> & {
828828
/**
829829
* The objectIDs to delete.
830830
*/
831831
objectIDs: string[];
832832
};
833833

834-
export type PartialUpdateObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'objects' | 'waitForTasks'> & {
834+
export type PartialUpdateObjectsOptions = Pick<
835+
ChunkedBatchOptions,
836+
'indexName' | 'objects' | 'waitForTasks' | 'batchSize'
837+
> & {
835838
/**
836839
*To be provided if non-existing objects are passed, otherwise, the call will fail.
837840
*/
838841
createIfNotExists?: boolean;
839842
};
840843

841-
export type SaveObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'objects' | 'waitForTasks'>;
844+
export type SaveObjectsOptions = Pick<ChunkedBatchOptions, 'indexName' | 'objects' | 'waitForTasks' | 'batchSize'>;
842845

843846
export type ChunkedBatchOptions = ReplaceAllObjectsOptions & {
844847
/**

clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,18 @@ export function createSearchClient({
550550
* @param saveObjects - The `saveObjects` object.
551551
* @param saveObjects.indexName - The `indexName` to save `objects` in.
552552
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
553+
* @param chunkedBatch.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
553554
* @param saveObjects.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.
554555
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
555556
*/
556557
async saveObjects(
557-
{ indexName, objects, waitForTasks }: SaveObjectsOptions,
558+
{ indexName, objects, waitForTasks, batchSize }: SaveObjectsOptions,
558559
requestOptions?: RequestOptions,
559560
): Promise<BatchResponse[]> {
560-
return await this.chunkedBatch({ indexName, objects, action: 'addObject', waitForTasks }, requestOptions);
561+
return await this.chunkedBatch(
562+
{ indexName, objects, action: 'addObject', waitForTasks, batchSize },
563+
requestOptions,
564+
);
561565
},
562566

563567
/**
@@ -567,11 +571,12 @@ export function createSearchClient({
567571
* @param deleteObjects - The `deleteObjects` object.
568572
* @param deleteObjects.indexName - The `indexName` to delete `objectIDs` from.
569573
* @param deleteObjects.objectIDs - The objectIDs to delete.
574+
* @param chunkedBatch.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
570575
* @param deleteObjects.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.
571576
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
572577
*/
573578
async deleteObjects(
574-
{ indexName, objectIDs, waitForTasks }: DeleteObjectsOptions,
579+
{ indexName, objectIDs, waitForTasks, batchSize }: DeleteObjectsOptions,
575580
requestOptions?: RequestOptions,
576581
): Promise<BatchResponse[]> {
577582
return await this.chunkedBatch(
@@ -580,6 +585,7 @@ export function createSearchClient({
580585
objects: objectIDs.map((objectID) => ({ objectID })),
581586
action: 'deleteObject',
582587
waitForTasks,
588+
batchSize,
583589
},
584590
requestOptions,
585591
);
@@ -593,18 +599,20 @@ export function createSearchClient({
593599
* @param partialUpdateObjects.indexName - The `indexName` to update `objects` in.
594600
* @param partialUpdateObjects.objects - The array of `objects` to update in the given Algolia `indexName`.
595601
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail..
602+
* @param chunkedBatch.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
596603
* @param partialUpdateObjects.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.
597604
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
598605
*/
599606
async partialUpdateObjects(
600-
{ indexName, objects, createIfNotExists, waitForTasks }: PartialUpdateObjectsOptions,
607+
{ indexName, objects, createIfNotExists, waitForTasks, batchSize }: PartialUpdateObjectsOptions,
601608
requestOptions?: RequestOptions,
602609
): Promise<BatchResponse[]> {
603610
return await this.chunkedBatch(
604611
{
605612
indexName,
606613
objects,
607614
action: createIfNotExists ? 'partialUpdateObject' : 'partialUpdateObjectNoCreate',
615+
batchSize,
608616
waitForTasks,
609617
},
610618
requestOptions,

clients/algoliasearch-client-php/lib/Api/SearchClient.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,31 +2945,33 @@ public function replaceAllObjects($indexName, $objects, $batchSize = 1000, $requ
29452945
*
29462946
* @param string $indexName the `indexName` to replace `objects` in
29472947
* @param array $objects the array of `objects` to store in the given Algolia `indexName`
2948+
* @param array $batchSize The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
29482949
* @param array $requestOptions Request options
29492950
* @param bool $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
29502951
*/
2951-
public function saveObjects($indexName, $objects, $requestOptions = [], $waitForTasks = false)
2952+
public function saveObjects($indexName, $objects, $batchSize = 1000, $requestOptions = [], $waitForTasks = false)
29522953
{
2953-
return $this->chunkedBatch($indexName, $objects, 'addObject', $waitForTasks, 1000, $requestOptions);
2954+
return $this->chunkedBatch($indexName, $objects, 'addObject', $waitForTasks, $batchSize, $requestOptions);
29542955
}
29552956

29562957
/**
29572958
* 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.
29582959
*
29592960
* @param string $indexName the `indexName` to delete `objectIDs` from
29602961
* @param array $objectIDs the `objectIDs` to delete
2962+
* @param array $batchSize The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
29612963
* @param array $requestOptions Request options
29622964
* @param bool $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
29632965
*/
2964-
public function deleteObjects($indexName, $objectIDs, $requestOptions = [], $waitForTasks = false)
2966+
public function deleteObjects($indexName, $objectIDs, $batchSize = 1000, $requestOptions = [], $waitForTasks = false)
29652967
{
29662968
$objects = [];
29672969

29682970
foreach ($objectIDs as $id) {
29692971
$objects[] = ['objectID' => $id];
29702972
}
29712973

2972-
return $this->chunkedBatch($indexName, $objects, 'deleteObject', $waitForTasks, 1000, $requestOptions);
2974+
return $this->chunkedBatch($indexName, $objects, 'deleteObject', $waitForTasks, $batchSize, $requestOptions);
29732975
}
29742976

29752977
/**
@@ -2978,12 +2980,13 @@ public function deleteObjects($indexName, $objectIDs, $requestOptions = [], $wai
29782980
* @param string $indexName the `indexName` to replace `objects` in
29792981
* @param array $objects the array of `objects` to store in the given Algolia `indexName`
29802982
* @param bool $createIfNotExists To be provided if non-existing objects are passed, otherwise, the call will fail..
2983+
* @param array $batchSize The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
29812984
* @param array $requestOptions Request options
29822985
* @param bool $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
29832986
*/
2984-
public function partialUpdateObjects($indexName, $objects, $createIfNotExists, $requestOptions = [], $waitForTasks = false)
2987+
public function partialUpdateObjects($indexName, $objects, $createIfNotExists, $batchSize = 1000, $requestOptions = [], $waitForTasks = false)
29852988
{
2986-
return $this->chunkedBatch($indexName, $objects, (true == $createIfNotExists) ? 'partialUpdateObject' : 'partialUpdateObjectNoCreate', $waitForTasks, 1000, $requestOptions);
2989+
return $this->chunkedBatch($indexName, $objects, (true == $createIfNotExists) ? 'partialUpdateObject' : 'partialUpdateObjectNoCreate', $waitForTasks, $batchSize, $requestOptions);
29872990
}
29882991

29892992
/**

0 commit comments

Comments
 (0)