Skip to content

Commit a4377a1

Browse files
committed
swift
1 parent 6813d55 commit a4377a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clients/algoliasearch-client-swift/Sources/Search/Extra/SearchClientExtension.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,15 @@ public extension SearchClient {
548548
/// - parameter indexName: The name of the index where to replace the objects
549549
/// - parameter objects: The new objects
550550
/// - parameter batchSize: The maximum number of objects to include in a batch
551+
/// - parameter scopes: The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms']
551552
/// - parameter requestOptions: The request options
552553
/// - returns: ReplaceAllObjectsResponse
553554
@discardableResult
554555
func replaceAllObjects(
555556
indexName: String,
556557
objects: [some Encodable],
557558
batchSize: Int = 1000,
559+
scopes: [ScopeType] = [.settings, .rules, .synonyms],
558560
requestOptions: RequestOptions? = nil
559561
) async throws -> ReplaceAllObjectsResponse {
560562
let tmpIndexName = "\(indexName)_tmp_\(Int.random(in: 1_000_000 ..< 10_000_000))"
@@ -565,7 +567,7 @@ public extension SearchClient {
565567
operationIndexParams: OperationIndexParams(
566568
operation: .copy,
567569
destination: tmpIndexName,
568-
scope: [.settings, .rules, .synonyms]
570+
scope: scopes
569571
),
570572
requestOptions: requestOptions
571573
)
@@ -584,7 +586,7 @@ public extension SearchClient {
584586
operationIndexParams: OperationIndexParams(
585587
operation: .copy,
586588
destination: tmpIndexName,
587-
scope: [.settings, .rules, .synonyms]
589+
scope: scopes
588590
),
589591
requestOptions: requestOptions
590592
)

0 commit comments

Comments
 (0)