customNormalization parameter lets you define how Algolia should transform specific characters.
Usage
- The input of a custom normalization must contain a single character.
- The output of a custom normalization must have at most two characters.
-
Doesn’t apply to decomposed Unicode characters that use combining marks.
For example:- You can’t normalize
üif it’s encoded asu(U+0075) +◌̈(U+0308). - You can normalize
üif it’s the represented by the characterü(U+00FC).
- You can’t normalize
Example
Current API clients
Current API clients
var response = await client.SetSettingsAsync(
"INDEX_NAME",
new IndexSettings
{
CustomNormalization = new Dictionary<string, Dictionary<string, string>>
{
{
"default",
new Dictionary<string, string> { { "ä", "ae" } }
},
},
}
);
final response = await client.setSettings(
indexName: "INDEX_NAME",
indexSettings: IndexSettings(
customNormalization: {
'default': {
'ä': "ae",
},
},
),
);
response, err := client.SetSettings(client.NewApiSetSettingsRequest(
"INDEX_NAME",
search.NewEmptyIndexSettings().SetCustomNormalization(map[string]map[string]string{"default": {"ä": "ae"}})))
if err != nil {
// handle the eventual error
panic(err)
}
UpdatedAtResponse response = client.setSettings(
"INDEX_NAME",
new IndexSettings().setCustomNormalization(
new HashMap() {
{
put(
"default",
new HashMap() {
{
put("ä", "ae");
}
}
);
}
}
)
);
const response = await client.setSettings({
indexName: 'theIndexName',
indexSettings: { customNormalization: { default: { ä: 'ae' } } },
});
var response =
client.setSettings(
indexName = "INDEX_NAME",
indexSettings = IndexSettings(customNormalization = mapOf("default" to mapOf("ä" to "ae"))),
)
$response = $client->setSettings(
'INDEX_NAME',
['customNormalization' => ['default' => ['ä' => 'ae',
],
],
],
);
response = client.set_settings(
index_name="INDEX_NAME",
index_settings={
"customNormalization": {
"default": {
"ä": "ae",
},
},
},
)
response = client.set_settings(
"INDEX_NAME",
Algolia::Search::IndexSettings.new(custom_normalization: {default: {ä: "ae"}})
)
val response = Await.result(
client.setSettings(
indexName = "INDEX_NAME",
indexSettings = IndexSettings(
customNormalization = Some(Map("default" -> Map("ä" -> "ae")))
)
),
Duration(100, "sec")
)
let response = try await client.setSettings(
indexName: "INDEX_NAME",
indexSettings: IndexSettings(customNormalization: ["default": ["ä": "ae"]])
)
Legacy API clients
Legacy API clients
IndexSettings settings = new IndexSettings();
settings.CustomNormalization =
new Dictionary>
{
{ "default", new Dictionary { {"ä", "ae"} } }
};
index.SetSettings(settings);
res, err := index.SetSettings(search.Settings{
CustomNormalization: opt.CustomNormalization(map[string]map[string]string{
"default": {"ä": "ae"},
}),
})
IndexSettings settings = new IndexSettings();
settings.setCustomNormalization(
new HashMap>() {
{
put(
"default",
new HashMap() {
{
put("ä", "ae");
}
});
}
});
index.setSettings(settings);
index
.setSettings({
customNormalization: {
default: { ä: "ae" },
},
})
.then(() => {
// done
});
val settings = settings {
customNormalization = mapOf(
"default" to mapOf(
"ä" to "ae",
"ü" to "ue"
)
)
}
index.setSettings(settings)
$index->setSettings([
'customNormalization' => [
'default' => [
'ä' => 'ae'
]
]
]);
index.set_settings(
{
"custom_normalization": {
"default": {"ä": "ae"},
},
}
)
index.set_settings(
{
:"customNormalization" => {
default: {:"ä" => "ae"}
}
}
)
client.execute {
setSettings of "myIndex" `with` IndexSettings(
customNormalization = Some(Map("default" -> Map("ä" -> "ae")))
)
}
let settings = Settings()
.set(\.customNormalization, to: [
"default": [
"ä": "ae",
"ü": "ue"
]
])
index.setSettings(settings) { result in
if case .success(let response) = result {
print("Response: \(response)")
}
}