Skip to content

Commit

Permalink
feat(clients): add optionnal scopes to replaceAllObjects [skip-bc] (g…
Browse files Browse the repository at this point in the history
…enerated)

algolia/api-clients-automation#4296

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
algolia-bot and millotp committed Jan 7, 2025
1 parent 2254daf commit b7f15d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/scala/algoliasearch/api/SearchClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import algoliasearch.search.ReplaceSourceResponse
import algoliasearch.search.Rule
import algoliasearch.search.SaveObjectResponse
import algoliasearch.search.SaveSynonymResponse
import algoliasearch.search.ScopeType._
import algoliasearch.search.SearchDictionaryEntriesParams
import algoliasearch.search.SearchDictionaryEntriesResponse
import algoliasearch.search.SearchForFacetValuesRequest
Expand Down
7 changes: 5 additions & 2 deletions src/main/scala/algoliasearch/extension/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ package object extension {
* The list of objects to replace.
* @param batchSize
* The size of the batch. Default is 1000.
* @param scopes
* The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
* @param requestOptions
* Additional request configuration.
* @return
Expand All @@ -362,6 +364,7 @@ package object extension {
indexName: String,
objects: Seq[Any],
batchSize: Int = 1000,
scopes: Option[Seq[ScopeType]] = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms)),
requestOptions: Option[RequestOptions] = None
)(implicit ec: ExecutionContext): Future[ReplaceAllObjectsResponse] = {
val tmpIndexName = s"${indexName}_tmp_${scala.util.Random.nextInt(100)}"
Expand All @@ -373,7 +376,7 @@ package object extension {
operationIndexParams = OperationIndexParams(
operation = OperationType.Copy,
destination = tmpIndexName,
scope = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms))
scope = scopes
),
requestOptions = requestOptions
)
Expand All @@ -394,7 +397,7 @@ package object extension {
operationIndexParams = OperationIndexParams(
operation = OperationType.Copy,
destination = tmpIndexName,
scope = Some(Seq(ScopeType.Settings, ScopeType.Rules, ScopeType.Synonyms))
scope = scopes
),
requestOptions = requestOptions
)
Expand Down

0 comments on commit b7f15d3

Please sign in to comment.