Skip to content

Commit b7f15d3

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 2254daf commit b7f15d3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/scala/algoliasearch/api/SearchClient.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import algoliasearch.search.ReplaceSourceResponse
4747
import algoliasearch.search.Rule
4848
import algoliasearch.search.SaveObjectResponse
4949
import algoliasearch.search.SaveSynonymResponse
50+
import algoliasearch.search.ScopeType._
5051
import algoliasearch.search.SearchDictionaryEntriesParams
5152
import algoliasearch.search.SearchDictionaryEntriesResponse
5253
import algoliasearch.search.SearchForFacetValuesRequest

src/main/scala/algoliasearch/extension/package.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ package object extension {
353353
* The list of objects to replace.
354354
* @param batchSize
355355
* The size of the batch. Default is 1000.
356+
* @param scopes
357+
* The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
356358
* @param requestOptions
357359
* Additional request configuration.
358360
* @return
@@ -362,6 +364,7 @@ package object extension {
362364
indexName: String,
363365
objects: Seq[Any],
364366
batchSize: Int = 1000,
367+
scopes: Option[Seq[ScopeType]] = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms)),
365368
requestOptions: Option[RequestOptions] = None
366369
)(implicit ec: ExecutionContext): Future[ReplaceAllObjectsResponse] = {
367370
val tmpIndexName = s"${indexName}_tmp_${scala.util.Random.nextInt(100)}"
@@ -373,7 +376,7 @@ package object extension {
373376
operationIndexParams = OperationIndexParams(
374377
operation = OperationType.Copy,
375378
destination = tmpIndexName,
376-
scope = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms))
379+
scope = scopes
377380
),
378381
requestOptions = requestOptions
379382
)
@@ -394,7 +397,7 @@ package object extension {
394397
operationIndexParams = OperationIndexParams(
395398
operation = OperationType.Copy,
396399
destination = tmpIndexName,
397-
scope = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms))
400+
scope = scopes
398401
),
399402
requestOptions = requestOptions
400403
)

0 commit comments

Comments
 (0)