File tree Expand file tree Collapse file tree 6 files changed +55
-3
lines changed
commonMain/kotlin/com/algolia/search
documentation/parameters/advanced Expand file tree Collapse file tree 6 files changed +55
-3
lines changed Original file line number Diff line number Diff line change @@ -363,7 +363,11 @@ public data class Settings(
363363 * Accepted value: [Language.Japanese]
364364 * Input data to index is treated as the given language(s) for segmentation.
365365 */
366- @SerialName(KeyIndexLanguages ) var indexLanguages : List <Language >? = null
366+ @SerialName(KeyIndexLanguages ) var indexLanguages : List <Language >? = null ,
367+ /* *
368+ * Override the custom normalization handled by the engine.
369+ */
370+ @SerialName(KeyCustomNormalization ) var customNormalization : Map <String , Map <String , String >>? = null
367371) {
368372
369373 /* *
Original file line number Diff line number Diff line change @@ -364,5 +364,6 @@ public const val KeySimilarQuery = "similarQuery"
364364public const val KeyEnableABTest = " enableABTest"
365365public const val KeyAlternatives = " alternatives"
366366public const val KeyIndexLanguages = " indexLanguages"
367+ public const val KeyCustomNormalization = " customNormalization"
367368public const val KeyFilterPromotes = " filterPromotes"
368369public const val KeyUsers = " users"
Original file line number Diff line number Diff line change 1+ package documentation.parameters.advanced
2+
3+ import com.algolia.search.dsl.query
4+ import com.algolia.search.dsl.settings
5+ import documentation.index
6+ import runBlocking
7+ import kotlin.test.Ignore
8+ import kotlin.test.Test
9+
10+
11+ @Ignore
12+ class DocCustomNormalization {
13+
14+ // customNormalization: Map<String, Map<String, String>> = mapOf(
15+ // "default" to mapOf(
16+ // "ä" to "ae",
17+ // "ü" to "ue"
18+ // )
19+ // )
20+
21+ @Test
22+ fun snippet1 () {
23+ runBlocking {
24+ val settings = settings {
25+ customNormalization = mapOf (
26+ " default" to mapOf (
27+ " ä" to " ae" ,
28+ " ü" to " ue"
29+ )
30+ )
31+ }
32+
33+ index.setSettings(settings)
34+ }
35+ }
36+ }
Original file line number Diff line number Diff line change @@ -355,6 +355,7 @@ internal class TestKeys {
355355 KeyEnableABTest shouldEqual " enableABTest"
356356 KeyAlternatives shouldEqual " alternatives"
357357 KeyIndexLanguages shouldEqual " indexLanguages"
358+ KeyCustomNormalization shouldEqual " customNormalization"
358359 KeyFilterPromotes shouldEqual " filterPromotes"
359360 KeyUsers shouldEqual " users"
360361 }
Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ internal class TestSettings : TestSerializer<Settings>(Settings.serializer()) {
8585 version = int,
8686 advancedSyntaxFeatures = listOf (AdvancedSyntaxFeatures .ExcludeWords , AdvancedSyntaxFeatures .ExactPhrase ),
8787 userData = json { unknown to unknown },
88- indexLanguages = listOf (Language .Japanese )
88+ indexLanguages = listOf (Language .Japanese ),
89+ customNormalization = mapOf (unknown to mapOf (unknown to unknown))
8990 ) to json {
9091 // Attributes
9192 KeySearchableAttributes to attributesJson
@@ -156,6 +157,9 @@ internal class TestSettings : TestSerializer<Settings>(Settings.serializer()) {
156157 KeyUserData to json { unknown to unknown }
157158 KeyPrimary to JsonNull
158159 KeyIndexLanguages to jsonArray { + Language .Japanese .raw }
160+ KeyCustomNormalization to json {
161+ unknown to json { unknown to unknown }
162+ }
159163 }
160164 )
161165
Original file line number Diff line number Diff line change 116116 "version" : 1 ,
117117 "indexLanguages" : [
118118 " ja"
119- ]
119+ ],
120+ "customNormalization" : {
121+ "default" : {
122+ "ä" : " ae" ,
123+ "ü" : " ue"
124+ }
125+ }
120126}
You can’t perform that action at this time.
0 commit comments