@@ -42,7 +42,7 @@ public extension Index {
4242 By making this true, the method will also send the synonym to all replicas.
4343 Thus, if you want to forward your synonyms to replicas you will need to specify that.
4444 - Parameter requestOptions: Configure request locally with RequestOptions
45- - Returns: SynonymRevision object
45+ - Returns: SynonymRevision object
4646 */
4747 @discardableResult func saveSynonym( _ synonym: Synonym ,
4848 forwardToReplicas: Bool ? = nil ,
@@ -74,9 +74,10 @@ public extension Index {
7474 - Parameter completion: Result completion
7575 - Returns: Launched asynchronous operation
7676 */
77+ @available ( * , deprecated, renamed: " saveSynonyms(_:forwardToReplicas:clearExistingSynonyms:requestOptions:completion:) " )
7778 @discardableResult func saveSynonyms( _ synonyms: [ Synonym ] ,
7879 forwardToReplicas: Bool ? = nil ,
79- replaceExistingSynonyms: Bool ? = nil ,
80+ replaceExistingSynonyms: Bool ? ,
8081 requestOptions: RequestOptions ? = nil ,
8182 completion: @escaping ResultCallback < IndexRevision > ) -> Operation {
8283 let command = Command . Synonym. SaveList ( indexName: name, synonyms: synonyms, forwardToReplicas: forwardToReplicas, clearExistingSynonyms: replaceExistingSynonyms, requestOptions: requestOptions)
@@ -101,15 +102,74 @@ public extension Index {
101102 This parameter tells the engine to delete all existing synonyms before recreating a new list from the synonyms listed in the current call.
102103 This is the only way to avoid having no synonyms, ensuring that your index will always provide a full list of synonyms to your end-users.
103104 - Parameter requestOptions: Configure request locally with RequestOptions
104- - Returns: SynonymRevision object
105+ - Returns: IndexRevision object
105106 */
107+ @available ( * , deprecated, renamed: " saveSynonyms(_:forwardToReplicas:clearExistingSynonyms:requestOptions:) " )
106108 @discardableResult func saveSynonyms( _ synonyms: [ Synonym ] ,
107109 forwardToReplicas: Bool ? = nil ,
108- replaceExistingSynonyms: Bool ? = nil ,
110+ replaceExistingSynonyms: Bool ? ,
109111 requestOptions: RequestOptions ? = nil ) throws -> WaitableWrapper < IndexRevision > {
110112 let command = Command . Synonym. SaveList ( indexName: name, synonyms: synonyms, forwardToReplicas: forwardToReplicas, clearExistingSynonyms: replaceExistingSynonyms, requestOptions: requestOptions)
111113 return try execute ( command)
112114 }
115+
116+ /**
117+ Create or update multiple synonym.
118+ This method enables you to create or update one or more synonym in a single call.
119+ You can also recreate your entire set of synonym by using the clearExistingSynonyms parameter.
120+ Note that each synonym object counts as a single indexing operation.
121+
122+ - Parameter synonyms: List of synonym to save.
123+ - Parameter forwardToReplicas: By default, this method applies only to the specified index.
124+ By making this true, the method will also send the synonym to all replicas.
125+ Thus, if you want to forward your synonyms to replicas you will need to specify that.
126+ - Parameter clearExistingSynonyms: Forces the engine to replace all synonyms, using an atomic save.
127+ Normally, to replace all synonyms on an index, you would first clear the synonyms, using clearAllSynonyms, and then create a new list.
128+ However, between the clear and the add, your index will have no synonyms.
129+ This is where clearExistingSynonyms comes into play.
130+ By adding this parameter, you do not need to use clearSynonyms, it’s done for you.
131+ This parameter tells the engine to delete all existing synonyms before recreating a new list from the synonyms listed in the current call.
132+ This is the only way to avoid having no synonyms, ensuring that your index will always provide a full list of synonyms to your end-users.
133+ - Parameter requestOptions: Configure request locally with RequestOptions
134+ - Parameter completion: Result completion
135+ - Returns: Launched asynchronous operation
136+ */
137+ @discardableResult func saveSynonyms( _ synonyms: [ Synonym ] ,
138+ forwardToReplicas: Bool ? = nil ,
139+ clearExistingSynonyms: Bool ? = nil ,
140+ requestOptions: RequestOptions ? = nil ,
141+ completion: @escaping ResultCallback < IndexRevision > ) -> Operation {
142+ let command = Command . Synonym. SaveList ( indexName: name, synonyms: synonyms, forwardToReplicas: forwardToReplicas, clearExistingSynonyms: clearExistingSynonyms, requestOptions: requestOptions)
143+ return execute ( command, completion: completion)
144+ }
145+
146+ /**
147+ Create or update multiple synonym.
148+ This method enables you to create or update one or more synonym in a single call.
149+ You can also recreate your entire set of synonym by using the clearExistingSynonyms parameter.
150+ Note that each synonym object counts as a single indexing operation.
151+
152+ - Parameter synonyms: List of synonym to save.
153+ - Parameter forwardToReplicas: By default, this method applies only to the specified index.
154+ By making this true, the method will also send the synonym to all replicas.
155+ Thus, if you want to forward your synonyms to replicas you will need to specify that.
156+ - Parameter clearExistingSynonyms: Forces the engine to replace all synonyms, using an atomic save.
157+ Normally, to replace all synonyms on an index, you would first clear the synonyms, using clearAllSynonyms, and then create a new list.
158+ However, between the clear and the add, your index will have no synonyms.
159+ This is where clearExistingSynonyms comes into play.
160+ By adding this parameter, you do not need to use clearSynonyms, it’s done for you.
161+ This parameter tells the engine to delete all existing synonyms before recreating a new list from the synonyms listed in the current call.
162+ This is the only way to avoid having no synonyms, ensuring that your index will always provide a full list of synonyms to your end-users.
163+ - Parameter requestOptions: Configure request locally with RequestOptions
164+ - Returns: IndexRevision object
165+ */
166+ @discardableResult func saveSynonyms( _ synonyms: [ Synonym ] ,
167+ forwardToReplicas: Bool ? = nil ,
168+ clearExistingSynonyms: Bool ? = nil ,
169+ requestOptions: RequestOptions ? = nil ) throws -> WaitableWrapper < IndexRevision > {
170+ let command = Command . Synonym. SaveList ( indexName: name, synonyms: synonyms, forwardToReplicas: forwardToReplicas, clearExistingSynonyms: clearExistingSynonyms, requestOptions: requestOptions)
171+ return try execute ( command)
172+ }
113173
114174 // MARK: - Get synonym
115175
@@ -133,7 +193,7 @@ public extension Index {
133193
134194 - Parameter objectID: ObjectID of the synonym to retrieve.
135195 - Parameter requestOptions: Configure request locally with RequestOptions
136- - Returns: Synonym object
196+ - Returns: Synonym object
137197 */
138198 @discardableResult func getSynonym( withID objectID: ObjectID ,
139199 requestOptions: RequestOptions ? = nil ) throws -> Synonym {
@@ -164,7 +224,7 @@ public extension Index {
164224
165225 - Parameter objectID: ObjectID of the synonym to delete.
166226 - Parameter requestOptions: Configure request locally with RequestOptions
167- - Returns: DeletionIndex object
227+ - Returns: IndexDeletion object
168228 */
169229 @discardableResult func deleteSynonym( withID objectID: ObjectID ,
170230 forwardToReplicas: Bool ? = nil ,
@@ -209,7 +269,7 @@ public extension Index {
209269 Remove all synonyms from an index. This is a convenience method to delete all synonyms at once.
210270 This Clear All method should not be used on a production index to push a new list of synonyms because it will
211271 result in a short down period during which the index would have no synonyms at all.
212- Instead, use the saveSynonyms method (with replaceExistingSynonyms set to true) to atomically replace all synonyms of an index with no down time.
272+ Instead, use the saveSynonyms method (with clearExistingSynonyms set to true) to atomically replace all synonyms of an index with no down time.
213273
214274 - Parameter forwardToReplicas: Also replace synonyms on replicas.
215275 - Parameter requestOptions: Configure request locally with RequestOptions
@@ -227,11 +287,11 @@ public extension Index {
227287 Remove all synonyms from an index. This is a convenience method to delete all synonyms at once.
228288 This Clear All method should not be used on a production index to push a new list of synonyms because it will
229289 result in a short down period during which the index would have no synonyms at all.
230- Instead, use the saveSynonyms method (with replaceExistingSynonyms set to true) to atomically replace all synonyms of an index with no down time.
290+ Instead, use the saveSynonyms method (with clearExistingSynonyms set to true) to atomically replace all synonyms of an index with no down time.
231291
232292 - Parameter forwardToReplicas: Also replace synonyms on replicas.
233293 - Parameter requestOptions: Configure request locally with RequestOptions
234- - Returns: RevisionIndex object
294+ - Returns: IndexRevision object
235295 */
236296 @discardableResult func clearSynonyms( forwardToReplicas: Bool ? = nil ,
237297 requestOptions: RequestOptions ? = nil ) throws -> WaitableWrapper < IndexRevision > {
@@ -256,7 +316,7 @@ public extension Index {
256316 forwardToReplicas: Bool ? = nil ,
257317 requestOptions: RequestOptions ? = nil ,
258318 completion: @escaping ResultCallback < IndexRevision > ) -> Operation {
259- saveSynonyms ( synonyms, forwardToReplicas: forwardToReplicas, replaceExistingSynonyms : true , requestOptions: requestOptions, completion: completion)
319+ saveSynonyms ( synonyms, forwardToReplicas: forwardToReplicas, clearExistingSynonyms : true , requestOptions: requestOptions, completion: completion)
260320 }
261321
262322 /**
@@ -267,12 +327,12 @@ public extension Index {
267327 - Parameter synonyms: A list of synonym.
268328 - Parameter forwardToReplicas: Also replace synonyms on replicas.
269329 - Parameter requestOptions: Configure request locally with RequestOptions
270- - Returns: RevisionIndex object
330+ - Returns: IndexRevision object
271331 */
272332 @discardableResult func replaceAllSynonyms( with synonyms: [ Synonym ] ,
273333 forwardToReplicas: Bool ? = nil ,
274334 requestOptions: RequestOptions ? = nil ) throws -> WaitableWrapper < IndexRevision > {
275- try saveSynonyms ( synonyms, forwardToReplicas: forwardToReplicas, replaceExistingSynonyms : true , requestOptions: requestOptions)
335+ try saveSynonyms ( synonyms, forwardToReplicas: forwardToReplicas, clearExistingSynonyms : true , requestOptions: requestOptions)
276336 }
277337
278338}
0 commit comments