Sep 20, 2024
Create or replace synonyms
If a synonym with the objectID
doesn’t exist, Algolia adds a new one.
Otherwise, existing synonyms are replaced.
This operation is subject to indexing rate limits.
Usage
Required ACL:
editSettings
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Search
let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")
let response = try await client.saveSynonyms(
indexName: "ALGOLIA_INDEX_NAME",
synonymHit: [
SynonymHit(objectID: "id1", type: SynonymType.synonym, synonyms: ["car", "vehicule", "auto"]),
SynonymHit(
objectID: "id2",
type: SynonymType.onewaysynonym,
synonyms: ["ephone", "aphone", "yphone"],
input: "iphone"
),
],
forwardToReplicas: true,
replaceExistingSynonyms: true
)
Did you find this page helpful?