Skip to content

Commit 9759e21

Browse files
chore: generated code for commit 3a97fad1. [skip ci]
algolia/api-clients-automation@3a97fad Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 11bbeea commit 9759e21

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/client-search/src/searchClient.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,10 @@ export function createSearchClient({
519519
let requests: BatchRequest[] = [];
520520
const responses: BatchResponse[] = [];
521521

522-
for (const [i, obj] of objects.entries()) {
522+
const objectEntries = objects.entries();
523+
for (const [i, obj] of objectEntries) {
523524
requests.push({ action, body: obj });
524-
if (i % batchSize === 0) {
525+
if (requests.length === batchSize || i === objects.length - 1) {
525526
responses.push(
526527
await this.batch(
527528
{ indexName, batchWriteParams: { requests } },
@@ -548,7 +549,7 @@ export function createSearchClient({
548549
* @param replaceAllObjects - The `replaceAllObjects` object.
549550
* @param replaceAllObjects.indexName - The `indexName` to replace `objects` in.
550551
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
551-
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
552+
* @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
552553
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
553554
*/
554555
async replaceAllObjects(

packages/recommend/model/rankingInfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type RankingInfo = {
1010
/**
1111
* Whether a filter matched the query.
1212
*/
13-
filters: number;
13+
filters?: number;
1414

1515
/**
1616
* Position of the first matched word in the best matching attribute of the record.
@@ -44,7 +44,7 @@ export type RankingInfo = {
4444
/**
4545
* Whether the record was promoted by a rule.
4646
*/
47-
promoted: boolean;
47+
promoted?: boolean;
4848

4949
/**
5050
* Number of words between multiple matches in the query plus 1. For single word queries, `proximityDistance` is 0.
@@ -59,7 +59,7 @@ export type RankingInfo = {
5959
/**
6060
* Number of matched words.
6161
*/
62-
words: number;
62+
words?: number;
6363

6464
/**
6565
* Whether the record is re-ranked.

0 commit comments

Comments
 (0)