Skip to content

Commit 3d212b4

Browse files
algolia-botmillotp
andcommitted
feat(clients): add optionnal scopes to replaceAllObjects [skip-bc] (generated)
algolia/api-clients-automation#4296 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 5bba4f8 commit 3d212b4

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

lib/algolia/api/search_client.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,10 +3472,17 @@ def chunked_batch(
34723472
# @param index_name [String] The `index_name` to replace `objects` in.
34733473
# @param objects [Array] The array of `objects` to store in the given Algolia `index_name`.
34743474
# @param batch_size [int] The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
3475+
# @param scopes [Array] The `scopes` to keep from the index. Defaults to `['settings', 'rules', 'synonyms']`.
34753476
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
34763477
#
34773478
# @return [Array<ReplaceAllObjectsResponse>]
3478-
def replace_all_objects(index_name, objects, batch_size = 1000, request_options = {})
3479+
def replace_all_objects(
3480+
index_name,
3481+
objects,
3482+
batch_size = 1000,
3483+
scopes = [Search::ScopeType::SETTINGS, Search::ScopeType::RULES, Search::ScopeType::SYNONYMS],
3484+
request_options = {}
3485+
)
34793486
tmp_index_name = index_name + "_tmp_" + rand(10_000_000).to_s
34803487

34813488
begin
@@ -3484,11 +3491,7 @@ def replace_all_objects(index_name, objects, batch_size = 1000, request_options
34843491
Search::OperationIndexParams.new(
34853492
operation: Search::OperationType::COPY,
34863493
destination: tmp_index_name,
3487-
scope: [
3488-
Search::ScopeType::SETTINGS,
3489-
Search::ScopeType::RULES,
3490-
Search::ScopeType::SYNONYMS
3491-
]
3494+
scope: scopes
34923495
),
34933496
request_options
34943497
)
@@ -3509,11 +3512,7 @@ def replace_all_objects(index_name, objects, batch_size = 1000, request_options
35093512
Search::OperationIndexParams.new(
35103513
operation: Search::OperationType::COPY,
35113514
destination: tmp_index_name,
3512-
scope: [
3513-
Search::ScopeType::SETTINGS,
3514-
Search::ScopeType::RULES,
3515-
Search::ScopeType::SYNONYMS
3516-
]
3515+
scope: scopes
35173516
),
35183517
request_options
35193518
)

0 commit comments

Comments
 (0)