Skip to content

Commit 6d35059

Browse files
authored
Merge branch 'main' into feat/add-chopper-requester-package
2 parents baa53ff + 07266f2 commit 6d35059

File tree

115 files changed

+1949
-823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1949
-823
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Utils/SearchClientExtensions.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -445,18 +445,18 @@ public async Task<ReplaceAllObjectsResponse> ReplaceAllObjectsAsync<T>(string in
445445

446446
var copyResponse = await OperationIndexAsync(indexName,
447447
new OperationIndexParams(OperationType.Copy, tmpIndexName)
448-
{ Scope = [ScopeType.Rules, ScopeType.Settings, ScopeType.Synonyms] }, options, cancellationToken)
448+
{ Scope = [ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms] }, options, cancellationToken)
449449
.ConfigureAwait(false);
450450

451-
var batchResponse = await ChunkedBatchAsync(tmpIndexName, objects, Action.AddObject, batchSize,
451+
var batchResponse = await ChunkedBatchAsync(tmpIndexName, objects, Action.AddObject, true, batchSize,
452452
options, cancellationToken).ConfigureAwait(false);
453453

454454
await WaitForTaskAsync(tmpIndexName, copyResponse.TaskID, requestOptions: options, ct: cancellationToken)
455455
.ConfigureAwait(false);
456456

457457
copyResponse = await OperationIndexAsync(indexName,
458458
new OperationIndexParams(OperationType.Copy, tmpIndexName)
459-
{ Scope = [ScopeType.Rules, ScopeType.Settings, ScopeType.Synonyms] }, options, cancellationToken)
459+
{ Scope = [ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms] }, options, cancellationToken)
460460
.ConfigureAwait(false);
461461
await WaitForTaskAsync(tmpIndexName, copyResponse.TaskID, requestOptions: options, ct: cancellationToken)
462462
.ConfigureAwait(false);
@@ -487,9 +487,9 @@ await WaitForTaskAsync(tmpIndexName, moveResponse.TaskID, requestOptions: option
487487
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
488488
/// <typeparam name="T"></typeparam>
489489
public List<BatchResponse> ChunkedBatch<T>(string indexName, IEnumerable<T> objects, Action action = Action.AddObject,
490-
int batchSize = 1000, RequestOptions options = null, CancellationToken cancellationToken = default)
490+
bool waitForTasks = false, int batchSize = 1000, RequestOptions options = null, CancellationToken cancellationToken = default)
491491
where T : class =>
492-
AsyncHelper.RunSync(() => ChunkedBatchAsync(indexName, objects, action, batchSize, options, cancellationToken));
492+
AsyncHelper.RunSync(() => ChunkedBatchAsync(indexName, objects, action, waitForTasks, batchSize, options, cancellationToken));
493493

494494
/// <summary>
495495
/// Helper: Chunks the given `objects` list in subset of 1000 elements max in order to make it fit in `batch` requests.
@@ -502,7 +502,7 @@ public List<BatchResponse> ChunkedBatch<T>(string indexName, IEnumerable<T> obje
502502
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
503503
/// <typeparam name="T"></typeparam>
504504
public async Task<List<BatchResponse>> ChunkedBatchAsync<T>(string indexName, IEnumerable<T> objects,
505-
Action action = Action.AddObject, int batchSize = 1000, RequestOptions options = null,
505+
Action action = Action.AddObject, bool waitForTasks = false, int batchSize = 1000, RequestOptions options = null,
506506
CancellationToken cancellationToken = default) where T : class
507507
{
508508
var batchCount = (int)Math.Ceiling((double)objects.Count() / batchSize);
@@ -518,10 +518,13 @@ public async Task<List<BatchResponse>> ChunkedBatchAsync<T>(string indexName, IE
518518
responses.Add(batchResponse);
519519
}
520520

521-
foreach (var batch in responses)
521+
if (waitForTasks)
522522
{
523-
await WaitForTaskAsync(indexName, batch.TaskID, requestOptions: options, ct: cancellationToken)
524-
.ConfigureAwait(false);
523+
foreach (var batch in responses)
524+
{
525+
await WaitForTaskAsync(indexName, batch.TaskID, requestOptions: options, ct: cancellationToken)
526+
.ConfigureAwait(false);
527+
}
525528
}
526529

527530
return responses;
@@ -544,7 +547,7 @@ public async Task<List<BatchResponse>> SaveObjectsAsync<T>(string indexName, IEn
544547
RequestOptions options = null,
545548
CancellationToken cancellationToken = default) where T : class
546549
{
547-
return await ChunkedBatchAsync(indexName, objects, Action.AddObject, 1000, options, cancellationToken).ConfigureAwait(false);
550+
return await ChunkedBatchAsync(indexName, objects, Action.AddObject, false, 1000, options, cancellationToken).ConfigureAwait(false);
548551
}
549552

550553
/// <summary>
@@ -554,11 +557,11 @@ public async Task<List<BatchResponse>> SaveObjectsAsync<T>(string indexName, IEn
554557
/// <param name="objectIDs">The list of `objectIDs` to remove from the given Algolia `indexName`.</param>
555558
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
556559
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
557-
public async Task<List<BatchResponse>> DeleteObjects(string indexName, IEnumerable<String> objectIDs,
560+
public async Task<List<BatchResponse>> DeleteObjectsAsync(string indexName, IEnumerable<String> objectIDs,
558561
RequestOptions options = null,
559562
CancellationToken cancellationToken = default)
560563
{
561-
return await ChunkedBatchAsync(indexName, objectIDs.Select(id => new { objectID = id }), Action.DeleteObject, 1000, options, cancellationToken).ConfigureAwait(false);
564+
return await ChunkedBatchAsync(indexName, objectIDs.Select(id => new { objectID = id }), Action.DeleteObject, false, 1000, options, cancellationToken).ConfigureAwait(false);
562565
}
563566

564567
/// <summary>
@@ -569,11 +572,11 @@ public async Task<List<BatchResponse>> DeleteObjects(string indexName, IEnumerab
569572
/// <param name="createIfNotExists">To be provided if non-existing objects are passed, otherwise, the call will fail.</param>
570573
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
571574
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
572-
public async Task<List<BatchResponse>> PartialUpdateObjects<T>(string indexName, IEnumerable<T> objects, bool createIfNotExists,
575+
public async Task<List<BatchResponse>> PartialUpdateObjectsAsync<T>(string indexName, IEnumerable<T> objects, bool createIfNotExists,
573576
RequestOptions options = null,
574577
CancellationToken cancellationToken = default) where T : class
575578
{
576-
return await ChunkedBatchAsync(indexName, objects, createIfNotExists ? Action.PartialUpdateObject : Action.PartialUpdateObjectNoCreate, 1000, options, cancellationToken).ConfigureAwait(false);
579+
return await ChunkedBatchAsync(indexName, objects, createIfNotExists ? Action.PartialUpdateObject : Action.PartialUpdateObjectNoCreate, false, 1000, options, cancellationToken).ConfigureAwait(false);
577580
}
578581

579582
private static async Task<List<TU>> CreateIterable<TU>(Func<TU, Task<TU>> executeQuery,

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/browse_params_object.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ final class BrowseParamsObject {
600600
attributeCriteriaComputedByMinProximity.hashCode +
601601
renderingContent.hashCode +
602602
enableReRanking.hashCode +
603-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode) +
603+
reRankingApplyFilter.hashCode +
604604
cursor.hashCode;
605605

606606
factory BrowseParamsObject.fromJson(Map<String, dynamic> json) =>

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/consequence_params.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ final class ConsequenceParams {
611611
attributeCriteriaComputedByMinProximity.hashCode +
612612
renderingContent.hashCode +
613613
enableReRanking.hashCode +
614-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode) +
614+
reRankingApplyFilter.hashCode +
615615
query.hashCode +
616616
automaticFacetFilters.hashCode +
617617
automaticOptionalFacetFilters.hashCode;

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/fallback_params.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ final class FallbackParams {
594594
attributeCriteriaComputedByMinProximity.hashCode +
595595
renderingContent.hashCode +
596596
enableReRanking.hashCode +
597-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode);
597+
reRankingApplyFilter.hashCode;
598598

599599
factory FallbackParams.fromJson(Map<String, dynamic> json) =>
600600
_$FallbackParamsFromJson(json);

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/index_settings.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ final class IndexSettings {
470470
attributeCriteriaComputedByMinProximity.hashCode +
471471
renderingContent.hashCode +
472472
enableReRanking.hashCode +
473-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode);
473+
reRankingApplyFilter.hashCode;
474474

475475
factory IndexSettings.fromJson(Map<String, dynamic> json) =>
476476
_$IndexSettingsFromJson(json);

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_for_facets.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ final class SearchForFacets {
618618
attributeCriteriaComputedByMinProximity.hashCode +
619619
renderingContent.hashCode +
620620
enableReRanking.hashCode +
621-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode) +
621+
reRankingApplyFilter.hashCode +
622622
facet.hashCode +
623623
indexName.hashCode +
624624
facetQuery.hashCode +

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_for_hits.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ final class SearchForHits {
606606
attributeCriteriaComputedByMinProximity.hashCode +
607607
renderingContent.hashCode +
608608
enableReRanking.hashCode +
609-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode) +
609+
reRankingApplyFilter.hashCode +
610610
indexName.hashCode +
611611
type.hashCode;
612612

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_params.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ final class SearchParams {
594594
attributeCriteriaComputedByMinProximity.hashCode +
595595
renderingContent.hashCode +
596596
enableReRanking.hashCode +
597-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode);
597+
reRankingApplyFilter.hashCode;
598598

599599
factory SearchParams.fromJson(Map<String, dynamic> json) =>
600600
_$SearchParamsFromJson(json);

clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/search_params_object.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ final class SearchParamsObject {
594594
attributeCriteriaComputedByMinProximity.hashCode +
595595
renderingContent.hashCode +
596596
enableReRanking.hashCode +
597-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode);
597+
reRankingApplyFilter.hashCode;
598598

599599
factory SearchParamsObject.fromJson(Map<String, dynamic> json) =>
600600
_$SearchParamsObjectFromJson(json);

clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/fallback_params.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ final class FallbackParams {
594594
attributeCriteriaComputedByMinProximity.hashCode +
595595
renderingContent.hashCode +
596596
enableReRanking.hashCode +
597-
(reRankingApplyFilter == null ? 0 : reRankingApplyFilter.hashCode);
597+
reRankingApplyFilter.hashCode;
598598

599599
factory FallbackParams.fromJson(Map<String, dynamic> json) =>
600600
_$FallbackParamsFromJson(json);

0 commit comments

Comments
 (0)