forked from meilisearch/meilisearch-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsTest.java
More file actions
1552 lines (1298 loc) · 73.8 KB
/
SettingsTest.java
File metadata and controls
1552 lines (1298 loc) · 73.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package com.meilisearch.integration;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.aMapWithSize;
import static org.hamcrest.Matchers.anEmptyMap;
import static org.hamcrest.Matchers.arrayWithSize;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.emptyArray;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import com.meilisearch.integration.classes.AbstractIT;
import com.meilisearch.integration.classes.TestData;
import com.meilisearch.sdk.Index;
import com.meilisearch.sdk.model.Embedder;
import com.meilisearch.sdk.model.EmbedderDistribution;
import com.meilisearch.sdk.model.EmbedderSource;
import com.meilisearch.sdk.model.FacetSortValue;
import com.meilisearch.sdk.model.Faceting;
import com.meilisearch.sdk.model.LocalizedAttribute;
import com.meilisearch.sdk.model.Pagination;
import com.meilisearch.sdk.model.Settings;
import com.meilisearch.sdk.model.TaskInfo;
import com.meilisearch.sdk.model.TypoTolerance;
import com.meilisearch.sdk.utils.Movie;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@Tag("integration")
public class SettingsTest extends AbstractIT {
private TestData<Movie> testData;
@BeforeEach
public void initialize() {
this.setUp();
if (testData == null) testData = this.getTestData(MOVIES_INDEX, Movie.class);
}
@AfterAll
static void cleanMeilisearch() {
cleanup();
}
/** Tests of the setting methods */
@Test
@DisplayName("Test get settings from an index by uid")
public void testGetSettings() throws Exception {
Index index = createIndex("getSettings");
Settings settings = index.getSettings();
assertThat(settings.getRankingRules(), is(arrayWithSize(6)));
}
@Test
@DisplayName("Test update settings changing the ranking rules")
public void testUpdateSettingsRankingRules() throws Exception {
Index index = createIndex("updateSettingsRankingRules");
Settings settings = index.getSettings();
settings.setRankingRules(
new String[] {
"typo",
"words",
"sort",
"proximity",
"attribute",
"exactness",
"release_date:desc",
"rank:desc"
});
index.waitForTask(index.updateSettings(settings).getTaskUid());
Settings newSettings = index.getSettings();
assertThat(newSettings.getRankingRules(), is(arrayWithSize(8)));
}
@Test
@DisplayName("Test update settings changing the synonyms")
public void testUpdateSettingsSynonyms() throws Exception {
Index index = createIndex("updateSettingsSynonyms");
Settings settings = index.getSettings();
HashMap<String, String[]> synonyms = new HashMap<>();
synonyms.put("wolverine", new String[] {"xmen", "logan"});
synonyms.put("logan", new String[] {"wolverine"});
settings.setSynonyms(synonyms);
index.waitForTask(index.updateSettings(settings).getTaskUid());
Settings newSettings = index.getSettings();
assertThat(newSettings.getSynonyms(), is(aMapWithSize(2)));
}
@Test
@DisplayName("Test update settings changing the sort")
public void testUpdateSettingsSort() throws Exception {
Index index = createIndex("updateSettingsSort");
Settings settings = index.getSettings();
settings.setSortableAttributes(new String[] {"title", "year"});
index.waitForTask(index.updateSettings(settings).getTaskUid());
Settings newSettings = index.getSettings();
assertThat(newSettings.getSortableAttributes(), is(arrayWithSize(2)));
}
@Test
@DisplayName("Test update settings changing the typo tolerance")
public void testUpdateSettingsTypoTolerance() throws Exception {
Index index = createIndex("updateSettingsTypoTolerance");
Settings settings = index.getSettings();
TypoTolerance typoTolerance = new TypoTolerance();
typoTolerance.setDisableOnWords(new String[] {"and"});
typoTolerance.setDisableOnAttributes(new String[] {"title"});
settings.setTypoTolerance(typoTolerance);
index.waitForTask(index.updateSettings(settings).getTaskUid());
Settings newSettings = index.getSettings();
assertThat(newSettings.getTypoTolerance().getDisableOnWords(), is(arrayWithSize(1)));
assertThat(newSettings.getTypoTolerance().getDisableOnAttributes(), is(arrayWithSize(1)));
assertThat(newSettings.getTypoTolerance().isEnabled(), is(equalTo(true)));
}
@Test
@DisplayName("Test update multiple settings in a row")
public void testUpdateMultipleSettingsInARow() throws Exception {
Index index = createIndex("updateMultipleSettingsInARow");
Settings settingsDisplayedAttr = new Settings();
settingsDisplayedAttr.setDisplayedAttributes(
new String[] {"title", "overview", "genres", "release_date"});
index.waitForTask(index.updateSettings(settingsDisplayedAttr).getTaskUid());
Settings newSettingsDisplayedAttr = index.getSettings();
Settings settingsRankingRules = new Settings();
settingsRankingRules.setRankingRules(
new String[] {
"typo",
"words",
"sort",
"proximity",
"attribute",
"exactness",
"release_date:desc",
"rank:desc"
});
index.waitForTask(index.updateSettings(settingsRankingRules).getTaskUid());
Settings newSettingsRankingRules = index.getSettings();
Settings settingsSynonyms = new Settings();
HashMap<String, String[]> synonyms = new HashMap<>();
synonyms.put("wolverine", new String[] {"xmen", "logan"});
synonyms.put("logan", new String[] {"wolverine"});
settingsSynonyms.setSynonyms(synonyms);
index.waitForTask(index.updateSettings(settingsSynonyms).getTaskUid());
Settings newSettingsSynonyms = index.getSettings();
assertThat(newSettingsDisplayedAttr.getDisplayedAttributes(), is(arrayWithSize(4)));
assertThat(newSettingsDisplayedAttr.getRankingRules(), is(arrayWithSize(6)));
assertThat(newSettingsDisplayedAttr.getSynonyms(), is(anEmptyMap()));
assertThat(newSettingsRankingRules.getDisplayedAttributes(), is(arrayWithSize(4)));
assertThat(newSettingsRankingRules.getRankingRules(), is(arrayWithSize(8)));
assertThat(newSettingsRankingRules.getSynonyms(), is(anEmptyMap()));
assertThat(newSettingsSynonyms.getDisplayedAttributes(), is(arrayWithSize(4)));
assertThat(newSettingsSynonyms.getSynonyms(), is(aMapWithSize(2)));
assertThat(newSettingsSynonyms.getRankingRules(), is(arrayWithSize(8)));
}
@Test
@DisplayName("Test reset settings")
public void testResetSettings() throws Exception {
Index index = createIndex("testResetSettings");
Settings initialSettings = index.getSettings();
Settings settingsWithSynonyms = new Settings();
HashMap<String, String[]> synonyms = new HashMap<>();
synonyms.put("wolverine", new String[] {"xmen", "logan"});
synonyms.put("logan", new String[] {"wolverine"});
settingsWithSynonyms.setSynonyms(synonyms);
index.waitForTask(index.updateSettings(settingsWithSynonyms).getTaskUid());
settingsWithSynonyms = index.getSettings();
assertThat(settingsWithSynonyms.getSynonyms(), is(aMapWithSize(2)));
index.waitForTask(index.resetSettings().getTaskUid());
Settings settingsAfterReset = index.getSettings();
assertThat(
settingsAfterReset.getSynonyms().size(),
equalTo(initialSettings.getSynonyms().size()));
}
/** Tests of the ranking rules setting methods */
@Test
@DisplayName("Test get ranking rules settings by uid")
public void testGetRankingRulesSettings() throws Exception {
Index index = createIndex("testGetRankingRulesSettings");
Settings initialSettings = index.getSettings();
String[] initialRankingRules = index.getRankingRulesSettings();
assertThat(
initialRankingRules, is(arrayWithSize(initialSettings.getRankingRules().length)));
assertThat(initialRankingRules, is(equalTo(initialSettings.getRankingRules())));
}
@Test
@DisplayName("Test update ranking rules settings")
public void testUpdateRankingRulesSettings() throws Exception {
Index index = createIndex("testUpdateRankingRulesSettings");
String[] initialRulesSettings = index.getRankingRulesSettings();
String[] newRankingRules = {
"typo",
"words",
"sort",
"proximity",
"attribute",
"exactness",
"release_date:desc",
"rank:desc"
};
index.waitForTask(index.updateRankingRulesSettings(newRankingRules).getTaskUid());
String[] updatedRankingRulesSettings = index.getRankingRulesSettings();
assertThat(updatedRankingRulesSettings, is(arrayWithSize(newRankingRules.length)));
assertThat(updatedRankingRulesSettings, is(equalTo(newRankingRules)));
assertThat(
updatedRankingRulesSettings, is(not(arrayWithSize(initialRulesSettings.length))));
}
@Test
@DisplayName("Test reset ranking rules settings")
public void testResetRankingRulesSettings() throws Exception {
Index index = createIndex("testResetRankingRulesSettings");
String[] initialRulesSettings = index.getRankingRulesSettings();
String[] newRankingRules = {
"typo",
"words",
"sort",
"proximity",
"attribute",
"exactness",
"release_date:desc",
"rank:desc"
};
index.waitForTask(index.updateRankingRulesSettings(newRankingRules).getTaskUid());
String[] updatedRankingRulesSettings = index.getRankingRulesSettings();
index.waitForTask(index.resetRankingRulesSettings().getTaskUid());
String[] rankingRulesAfterReset = index.getRankingRulesSettings();
assertThat(updatedRankingRulesSettings, is(arrayWithSize(newRankingRules.length)));
assertThat(updatedRankingRulesSettings, is(equalTo(newRankingRules)));
assertThat(
updatedRankingRulesSettings, is(not(arrayWithSize(initialRulesSettings.length))));
assertThat(
rankingRulesAfterReset, is(not(arrayWithSize(updatedRankingRulesSettings.length))));
assertThat(rankingRulesAfterReset, is(arrayWithSize(initialRulesSettings.length)));
assertThat(rankingRulesAfterReset, is(equalTo(initialRulesSettings)));
}
/** Tests of the synonyms setting methods */
@Test
@DisplayName("Test get synonyms settings by uid")
public void testGetSynonymsSettings() throws Exception {
Index index = createIndex("testGetSynonymsSettings");
Settings initialSettings = index.getSettings();
Map<String, String[]> synonymsSettings = index.getSynonymsSettings();
assertThat(synonymsSettings, is(aMapWithSize(initialSettings.getSynonyms().size())));
assertThat(synonymsSettings, is(equalTo(initialSettings.getSynonyms())));
}
@Test
@DisplayName("Test update synonyms settings")
public void testUpdateSynonymsSettings() throws Exception {
Index index = createIndex("testUpdateSynonymsSettings");
Map<String, String[]> synonymsSettings = index.getSynonymsSettings();
HashMap<String, String[]> newSynonymsSettings = new HashMap<>();
newSynonymsSettings.put("wolverine", new String[] {"xmen", "logan"});
newSynonymsSettings.put("logan", new String[] {"wolverine", "xmen"});
newSynonymsSettings.put("wow", new String[] {"world of warcraft"});
index.waitForTask(index.updateSynonymsSettings(newSynonymsSettings).getTaskUid());
Map<String, String[]> updatedSynonymsSettings = index.getSynonymsSettings();
assertThat(updatedSynonymsSettings, is(aMapWithSize(newSynonymsSettings.size())));
assertThat(updatedSynonymsSettings.keySet(), is(equalTo(newSynonymsSettings.keySet())));
assertThat(updatedSynonymsSettings, is(not(aMapWithSize(synonymsSettings.size()))));
assertThat(updatedSynonymsSettings.keySet(), is(not(equalTo(synonymsSettings.keySet()))));
}
@Test
@DisplayName("Test reset synonyms settings")
public void testResetSynonymsSettings() throws Exception {
Index index = createIndex("testResetSynonymsSettings");
Map<String, String[]> synonymsSettings = index.getSynonymsSettings();
HashMap<String, String[]> newSynonymsSettings = new HashMap<>();
newSynonymsSettings.put("wolverine", new String[] {"xmen", "logan"});
newSynonymsSettings.put("logan", new String[] {"wolverine", "xmen"});
newSynonymsSettings.put("wow", new String[] {"world of warcraft"});
index.waitForTask(index.updateSynonymsSettings(newSynonymsSettings).getTaskUid());
Map<String, String[]> updatedSynonymsSettings = index.getSynonymsSettings();
index.waitForTask(index.resetSynonymsSettings().getTaskUid());
Map<String, String[]> synonymsSettingsAfterReset = index.getSynonymsSettings();
assertThat(updatedSynonymsSettings, is(aMapWithSize(newSynonymsSettings.size())));
assertThat(updatedSynonymsSettings.keySet(), is(equalTo(newSynonymsSettings.keySet())));
assertThat(updatedSynonymsSettings, is(not(aMapWithSize(synonymsSettings.size()))));
assertThat(updatedSynonymsSettings.keySet(), is(not(equalTo(synonymsSettings.keySet()))));
assertThat(
synonymsSettingsAfterReset, is(not(aMapWithSize(updatedSynonymsSettings.size()))));
assertThat(synonymsSettingsAfterReset, is(aMapWithSize(synonymsSettings.size())));
assertThat(synonymsSettingsAfterReset.keySet(), is(equalTo(synonymsSettings.keySet())));
}
/** Tests of the stop words setting methods */
@Test
@DisplayName("Test get stop-words settings by uid")
public void testGetStopWordsSettings() throws Exception {
Index index = createIndex("testGetStopWordsSettings");
Settings initialSettings = index.getSettings();
String[] initialStopWords = index.getStopWordsSettings();
assertThat(initialStopWords, is(arrayWithSize(initialSettings.getStopWords().length)));
assertThat(initialStopWords, is(equalTo(initialSettings.getStopWords())));
}
@Test
@DisplayName("Test update stop-words settings")
public void testUpdateStopWordsSettings() throws Exception {
Index index = createIndex("testUpdateStopWordsSettings");
String[] initialStopWords = index.getStopWordsSettings();
String[] newStopWords = {"of", "the", "to"};
index.waitForTask(index.updateStopWordsSettings(newStopWords).getTaskUid());
String[] updatedStopWordsSettings = index.getStopWordsSettings();
assertThat(updatedStopWordsSettings, is(arrayWithSize(newStopWords.length)));
assertThat(updatedStopWordsSettings, is(equalTo(newStopWords)));
assertThat(updatedStopWordsSettings, is(not(arrayWithSize(initialStopWords.length))));
}
@Test
@DisplayName("Test reset stop-words settings")
public void testResetStopWordsSettings() throws Exception {
Index index = createIndex("testResetStopWordsSettings");
String[] initialStopWords = index.getStopWordsSettings();
String[] newStopWords = {"of", "the", "to"};
index.waitForTask(index.updateStopWordsSettings(newStopWords).getTaskUid());
String[] updatedStopWordsSettings = index.getStopWordsSettings();
index.waitForTask(index.resetStopWordsSettings().getTaskUid());
String[] stopWordsAfterReset = index.getStopWordsSettings();
assertThat(updatedStopWordsSettings, is(arrayWithSize(newStopWords.length)));
assertThat(updatedStopWordsSettings, is(equalTo(newStopWords)));
assertThat(updatedStopWordsSettings, is(not(arrayWithSize(initialStopWords.length))));
assertThat(stopWordsAfterReset, is(not(arrayWithSize(updatedStopWordsSettings.length))));
assertThat(stopWordsAfterReset, is(arrayWithSize(initialStopWords.length)));
assertThat(stopWordsAfterReset, is(equalTo(initialStopWords)));
}
/** Tests of the searchable attributes setting methods */
@Test
@DisplayName("Test get searchable attributes settings by uid")
public void testGetSearchableAttributesSettings() throws Exception {
Index index = createIndex("testGetSearchableAttributesSettings");
Settings initialSettings = index.getSettings();
String[] initialSearchableAttributes = index.getSearchableAttributesSettings();
assertThat(
initialSearchableAttributes,
is(arrayWithSize(initialSettings.getSearchableAttributes().length)));
assertThat(
initialSearchableAttributes,
is(equalTo(initialSettings.getSearchableAttributes())));
}
@Test
@DisplayName("Test update searchable attributes settings")
public void testUpdateSearchableAttributesSettings() throws Exception {
Index index = createIndex("testUpdateSearchableAttributesSettings");
String[] initialSearchableAttributes = index.getSearchableAttributesSettings();
String[] newSearchableAttributes = {"title", "description", "genre"};
index.waitForTask(
index.updateSearchableAttributesSettings(newSearchableAttributes).getTaskUid());
String[] updatedSearchableAttributes = index.getSearchableAttributesSettings();
assertThat(updatedSearchableAttributes, is(arrayWithSize(newSearchableAttributes.length)));
assertThat(updatedSearchableAttributes, is(equalTo(newSearchableAttributes)));
assertThat(
updatedSearchableAttributes,
is(not(arrayWithSize(initialSearchableAttributes.length))));
}
@Test
@DisplayName("Test reset searchable attributes settings")
public void testResetSearchableAttributesSettings() throws Exception {
Index index = createIndex("testUpdateSearchableAttributesSettings");
String[] initialSearchableAttributes = index.getSearchableAttributesSettings();
String[] newSearchableAttributes = {"title", "description", "genre"};
index.waitForTask(
index.updateSearchableAttributesSettings(newSearchableAttributes).getTaskUid());
String[] updatedSearchableAttributes = index.getSearchableAttributesSettings();
index.waitForTask(index.resetSearchableAttributesSettings().getTaskUid());
String[] searchableAttributesAfterReset = index.getSearchableAttributesSettings();
assertThat(updatedSearchableAttributes, is(arrayWithSize(newSearchableAttributes.length)));
assertThat(updatedSearchableAttributes, is(equalTo(newSearchableAttributes)));
assertThat(
updatedSearchableAttributes,
is(not(arrayWithSize(initialSearchableAttributes.length))));
assertThat(
searchableAttributesAfterReset,
is(not(arrayWithSize(updatedSearchableAttributes.length))));
assertThat(
searchableAttributesAfterReset,
is(arrayWithSize(initialSearchableAttributes.length)));
assertThat(searchableAttributesAfterReset, is(equalTo(initialSearchableAttributes)));
}
/** Tests of the display attributes setting methods */
@Test
@DisplayName("Test get display attributes settings by uid")
public void testGetDisplayedAttributesSettings() throws Exception {
Index index = createIndex("testGetDisplayedAttributesSettings");
Settings initialSettings = index.getSettings();
String[] initialDisplayedAttributes = index.getDisplayedAttributesSettings();
assertThat(
initialDisplayedAttributes,
is(arrayWithSize(initialSettings.getDisplayedAttributes().length)));
assertThat(
initialDisplayedAttributes, is(equalTo(initialSettings.getDisplayedAttributes())));
}
@Test
@DisplayName("Test update display attributes settings")
public void testUpdateDisplayedAttributesSettings() throws Exception {
Index index = createIndex("testUpdateDisplayedAttributesSettings");
String[] initialDisplayedAttributes = index.getDisplayedAttributesSettings();
String[] newDisplayedAttributes = {"title", "description", "genre", "release_date"};
index.waitForTask(
index.updateDisplayedAttributesSettings(newDisplayedAttributes).getTaskUid());
String[] updatedDisplayedAttributes = index.getDisplayedAttributesSettings();
assertThat(updatedDisplayedAttributes, is(arrayWithSize(newDisplayedAttributes.length)));
assertThat(updatedDisplayedAttributes, is(equalTo(newDisplayedAttributes)));
assertThat(
updatedDisplayedAttributes,
is(not(arrayWithSize(initialDisplayedAttributes.length))));
}
@Test
@DisplayName("Test reset display attributes settings")
public void testResetDisplayedAttributesSettings() throws Exception {
Index index = createIndex("testUpdateDisplayedAttributesSettings");
String[] initialDisplayedAttributes = index.getDisplayedAttributesSettings();
String[] newDisplayedAttributes = {"title", "description", "genre", "release_date", "cast"};
index.waitForTask(
index.updateDisplayedAttributesSettings(newDisplayedAttributes).getTaskUid());
String[] updatedDisplayedAttributes = index.getDisplayedAttributesSettings();
index.waitForTask(index.resetDisplayedAttributesSettings().getTaskUid());
String[] displayedAttributesAfterReset = index.getDisplayedAttributesSettings();
assertThat(updatedDisplayedAttributes, is(arrayWithSize(newDisplayedAttributes.length)));
assertThat(updatedDisplayedAttributes, is(equalTo(newDisplayedAttributes)));
assertThat(
updatedDisplayedAttributes,
is(not(arrayWithSize(initialDisplayedAttributes.length))));
assertThat(
displayedAttributesAfterReset,
is(not(arrayWithSize(updatedDisplayedAttributes.length))));
}
/** Tests of the localization attributes setting methods */
@Test
@DisplayName("Test get localized attributes settings by uid")
public void testGetLocalizedAttributesSettings() throws Exception {
Index index = createIndex("testGetLocalizedAttributesSettings");
Settings initialSettings = index.getSettings();
LocalizedAttribute[] initialLocalizedAttributes = index.getLocalizedAttributesSettings();
assertThat(
initialLocalizedAttributes, is(equalTo(initialSettings.getLocalizedAttributes())));
assertThat(
initialLocalizedAttributes, is(equalTo(initialSettings.getLocalizedAttributes())));
}
@Test
@DisplayName("Test update localized attributes settings")
public void testUpdateLocalizedAttributesSettings() throws Exception {
Index index = createIndex("testUpdateLocalizedAttributesSettings");
LocalizedAttribute[] initialLocalizedAttributes = index.getLocalizedAttributesSettings();
LocalizedAttribute firstAttribute = new LocalizedAttribute();
LocalizedAttribute secondAttribute = new LocalizedAttribute();
firstAttribute.setAttributePatterns(new String[] {"title", "description"});
firstAttribute.setLocales(new String[] {"eng", "fra"});
secondAttribute.setAttributePatterns(new String[] {"genre", "release_date"});
secondAttribute.setLocales(new String[] {"rus"});
LocalizedAttribute[] newLocalizedAttributes =
new LocalizedAttribute[] {firstAttribute, secondAttribute};
index.waitForTask(
index.updateLocalizedAttributesSettings(newLocalizedAttributes).getTaskUid());
LocalizedAttribute[] updatedLocalizedAttributes = index.getLocalizedAttributesSettings();
assertThat(updatedLocalizedAttributes, is(arrayWithSize(newLocalizedAttributes.length)));
assertThat(
updatedLocalizedAttributes[0].getAttributePatterns(),
is(equalTo(newLocalizedAttributes[0].getAttributePatterns())));
assertThat(
updatedLocalizedAttributes[0].getLocales(),
is(equalTo(newLocalizedAttributes[0].getLocales())));
assertThat(
updatedLocalizedAttributes[1].getAttributePatterns(),
is(equalTo(newLocalizedAttributes[1].getAttributePatterns())));
assertThat(
updatedLocalizedAttributes[1].getLocales(),
is(equalTo(newLocalizedAttributes[1].getLocales())));
assertThat(updatedLocalizedAttributes, is(not(equalTo(initialLocalizedAttributes))));
}
@Test
@DisplayName("Test reset localized attributes settings")
public void testResetLocalizedAttributesSettings() throws Exception {
Index index = createIndex("testResetLocalizedAttributesSettings");
LocalizedAttribute[] initialLocalizedAttributes = index.getLocalizedAttributesSettings();
LocalizedAttribute firstAttribute = new LocalizedAttribute();
LocalizedAttribute secondAttribute = new LocalizedAttribute();
firstAttribute.setAttributePatterns(new String[] {"title", "description"});
firstAttribute.setLocales(new String[] {"eng", "fra"});
secondAttribute.setAttributePatterns(new String[] {"genre", "release_date"});
secondAttribute.setLocales(new String[] {"rus"});
LocalizedAttribute[] newLocalizedAttributes =
new LocalizedAttribute[] {firstAttribute, secondAttribute};
index.waitForTask(
index.updateLocalizedAttributesSettings(newLocalizedAttributes).getTaskUid());
LocalizedAttribute[] updatedLocalizedAttributes = index.getLocalizedAttributesSettings();
index.waitForTask(index.resetLocalizedAttributesSettings().getTaskUid());
LocalizedAttribute[] localizedAttributesAfterReset = index.getLocalizedAttributesSettings();
assertThat(updatedLocalizedAttributes, is(arrayWithSize(newLocalizedAttributes.length)));
assertThat(
updatedLocalizedAttributes[0].getAttributePatterns(),
is(equalTo(newLocalizedAttributes[0].getAttributePatterns())));
assertThat(
updatedLocalizedAttributes[0].getLocales(),
is(equalTo(newLocalizedAttributes[0].getLocales())));
assertThat(
updatedLocalizedAttributes[1].getAttributePatterns(),
is(equalTo(newLocalizedAttributes[1].getAttributePatterns())));
assertThat(
updatedLocalizedAttributes[1].getLocales(),
is(equalTo(newLocalizedAttributes[1].getLocales())));
assertThat(updatedLocalizedAttributes, is(not(equalTo(initialLocalizedAttributes))));
assertThat(localizedAttributesAfterReset, is(not(equalTo(updatedLocalizedAttributes))));
}
/** Tests of the filterable attributes setting methods */
@Test
@DisplayName("Test get filterable attributes settings by uid")
public void testGetFilterableAttributesSettings() throws Exception {
Index index = createIndex("testGetDisplayedAttributesSettings");
Settings initialSettings = index.getSettings();
String[] initialFilterableAttributes = index.getFilterableAttributesSettings();
assertThat(
initialFilterableAttributes,
is(arrayWithSize(initialSettings.getFilterableAttributes().length)));
assertThat(
initialFilterableAttributes,
is(equalTo(initialSettings.getFilterableAttributes())));
}
@Test
@DisplayName("Test update filterable attributes settings")
public void testUpdateFilterableAttributesSettings() throws Exception {
Index index = createIndex("testUpdateDisplayedAttributesSettings");
String[] initialFilterableAttributes = index.getFilterableAttributesSettings();
String[] newFilterableAttributes = {"title", "description", "genre", "release_date"};
index.waitForTask(
index.updateFilterableAttributesSettings(newFilterableAttributes).getTaskUid());
String[] updatedFilterableAttributes = index.getFilterableAttributesSettings();
assertThat(updatedFilterableAttributes, is(arrayWithSize(newFilterableAttributes.length)));
assertThat(
Arrays.asList(newFilterableAttributes),
containsInAnyOrder(updatedFilterableAttributes));
assertThat(
updatedFilterableAttributes,
is(not(arrayWithSize(initialFilterableAttributes.length))));
}
@Test
@DisplayName("Test reset filterable attributes settings")
public void testResetFilterableAttributesSettings() throws Exception {
Index index = createIndex("testUpdateDisplayedAttributesSettings");
String[] initialFilterableAttributes = index.getFilterableAttributesSettings();
String[] newFilterableAttributes = {
"title", "description", "genres", "director", "release_date"
};
index.waitForTask(
index.updateFilterableAttributesSettings(newFilterableAttributes).getTaskUid());
String[] updatedFilterableAttributes = index.getFilterableAttributesSettings();
index.waitForTask(index.resetFilterableAttributesSettings().getTaskUid());
String[] filterableAttributesAfterReset = index.getFilterableAttributesSettings();
assertThat(updatedFilterableAttributes, is(arrayWithSize(newFilterableAttributes.length)));
assertThat(
Arrays.asList(newFilterableAttributes),
containsInAnyOrder(updatedFilterableAttributes));
assertThat(
updatedFilterableAttributes,
is(not(arrayWithSize(initialFilterableAttributes.length))));
assertThat(
filterableAttributesAfterReset,
is(not(arrayWithSize(updatedFilterableAttributes.length))));
assertThat(
updatedFilterableAttributes,
is(not(arrayWithSize(initialFilterableAttributes.length))));
}
/** Tests of the sortable attributes setting methods* */
@Test
@DisplayName("Test get sortable attributes settings by uid")
public void testGetSortableAttributesSettings() throws Exception {
Index index = createIndex("testGetSortableAttributesSettings");
Settings initialSettings = index.getSettings();
String[] initialSortableAttributes = index.getSortableAttributesSettings();
assertThat(
initialSortableAttributes,
is(arrayWithSize(initialSettings.getSortableAttributes().length)));
assertThat(initialSortableAttributes, is(equalTo(initialSettings.getSortableAttributes())));
}
@Test
@DisplayName("Test update sortable attributes settings")
public void testUpdateSortableAttributesSettings() throws Exception {
Index index = createIndex("testUpdateSortableAttributesSettings");
String[] initialSortableAttributes = index.getSortableAttributesSettings();
String[] newSortableAttributes = {"title", "description", "genre", "release_date"};
index.waitForTask(
index.updateSortableAttributesSettings(newSortableAttributes).getTaskUid());
String[] updatedSortableAttributes = index.getSortableAttributesSettings();
assertThat(updatedSortableAttributes, is(arrayWithSize(newSortableAttributes.length)));
assertThat(
Arrays.asList(newSortableAttributes),
containsInAnyOrder(updatedSortableAttributes));
assertThat(
updatedSortableAttributes,
is(not(arrayWithSize(initialSortableAttributes.length))));
}
@Test
@DisplayName("Test reset sortable attributes settings")
public void testResetSortableAttributesSettings() throws Exception {
Index index = createIndex("testUpdateSortableAttributesSettings");
String[] initialSortableAttributes = index.getSortableAttributesSettings();
String[] newSortableAttributes = {
"title", "description", "genres", "director", "release_date"
};
index.waitForTask(
index.updateSortableAttributesSettings(newSortableAttributes).getTaskUid());
String[] updatedSortableAttributes = index.getSortableAttributesSettings();
index.waitForTask(index.resetFilterableAttributesSettings().getTaskUid());
String[] filterableAttributesAfterReset = index.getFilterableAttributesSettings();
assertThat(updatedSortableAttributes, is(arrayWithSize(newSortableAttributes.length)));
assertThat(
Arrays.asList(newSortableAttributes),
containsInAnyOrder(updatedSortableAttributes));
assertThat(
updatedSortableAttributes,
is(not(arrayWithSize(initialSortableAttributes.length))));
assertThat(
filterableAttributesAfterReset,
is(not(arrayWithSize(updatedSortableAttributes.length))));
assertThat(
updatedSortableAttributes,
is(not(arrayWithSize(initialSortableAttributes.length))));
}
/** Tests of the distinct attributes setting methods */
@Test
@DisplayName("Test get distinct attribute settings by uid")
public void testGetDistinctAttributeSettings() throws Exception {
Index index = createIndex("testGetDistinctAttributeSettings");
Settings initialSettings = index.getSettings();
String initialDistinctAttribute = index.getDistinctAttributeSettings();
assertThat(initialDistinctAttribute, is(equalTo(initialSettings.getDistinctAttribute())));
}
@Test
@DisplayName("Test update distinct attribute settings")
public void testUpdateDistinctAttributeSettings() throws Exception {
Index index = createIndex("testUpdateDistinctAttributeSettings");
String initialDistinctAttribute = index.getDistinctAttributeSettings();
String newDistinctAttribute = "title";
index.waitForTask(index.updateDistinctAttributeSettings(newDistinctAttribute).getTaskUid());
String updatedDistinctAttribute = index.getDistinctAttributeSettings();
assertThat(updatedDistinctAttribute, is(equalTo(newDistinctAttribute)));
assertThat(updatedDistinctAttribute, is(not(equalTo(initialDistinctAttribute))));
}
@Test
@DisplayName("Test reset distinct attribute settings")
public void testResetDistinctAttributeSettings() throws Exception {
Index index = createIndex("testResetDistinctAttributeSettings");
String initialDistinctAttribute = index.getDistinctAttributeSettings();
String newDistinctAttribute = "title";
index.waitForTask(index.updateDistinctAttributeSettings(newDistinctAttribute).getTaskUid());
String updatedDistinctAttribute = index.getDistinctAttributeSettings();
index.waitForTask(index.resetDistinctAttributeSettings().getTaskUid());
String distinctAttributeAfterReset = index.getDistinctAttributeSettings();
assertThat(updatedDistinctAttribute, is(equalTo(newDistinctAttribute)));
assertThat(updatedDistinctAttribute, is(not(equalTo(initialDistinctAttribute))));
assertThat(distinctAttributeAfterReset, is(not(equalTo(updatedDistinctAttribute))));
assertThat(updatedDistinctAttribute, is(not(equalTo(initialDistinctAttribute))));
}
/** Tests of the typo tolerance setting methods */
@Test
@DisplayName("Test get typo tolerance settings by uid")
public void testGetTypoTolerance() throws Exception {
Index index = createIndex("testGetTypoTolerance");
Settings initialSettings = index.getSettings();
TypoTolerance initialTypoTolerance = index.getTypoToleranceSettings();
assertThat(initialSettings.getTypoTolerance().getDisableOnWords(), is(emptyArray()));
assertThat(initialTypoTolerance.getDisableOnWords(), is(emptyArray()));
assertThat(initialSettings.getTypoTolerance().getDisableOnAttributes(), is(emptyArray()));
assertThat(initialTypoTolerance.getDisableOnAttributes(), is(emptyArray()));
assertThat(
initialTypoTolerance.isEnabled(),
is(equalTo(initialSettings.getTypoTolerance().isEnabled())));
assertThat(
initialTypoTolerance.getMinWordSizeForTypos().containsKey("oneTypo"),
is(notNullValue()));
assertThat(
initialTypoTolerance.getMinWordSizeForTypos().get("oneTypo"), is(notNullValue()));
assertThat(
initialTypoTolerance.getMinWordSizeForTypos().containsKey("twoTypos"),
is(notNullValue()));
assertThat(
initialTypoTolerance.getMinWordSizeForTypos().get("twoTypos"), is(notNullValue()));
}
@Test
@DisplayName("Test update typo tolerance settings")
public void testUpdateTypoTolerance() throws Exception {
Index index = createIndex("testUpdateTypoTolerance");
TypoTolerance newTypoTolerance = new TypoTolerance();
newTypoTolerance.setEnabled(true);
newTypoTolerance.setDisableOnWords(new String[] {"and"});
newTypoTolerance.setDisableOnAttributes(new String[] {"title"});
HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("oneTypo", 7);
put("twoTypos", 10);
}
};
newTypoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
index.waitForTask(index.updateTypoToleranceSettings(newTypoTolerance).getTaskUid());
TypoTolerance updatedTypoTolerance = index.getTypoToleranceSettings();
assertThat(
updatedTypoTolerance.getDisableOnWords()[0],
is(equalTo(newTypoTolerance.getDisableOnWords()[0])));
assertThat(
updatedTypoTolerance.getDisableOnAttributes()[0],
is(equalTo(newTypoTolerance.getDisableOnAttributes()[0])));
assertThat(updatedTypoTolerance.isEnabled(), is(equalTo(true)));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos(), hasKey("oneTypo"));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos().get("oneTypo"), is(equalTo(7)));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos(), hasKey("twoTypos"));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos().get("twoTypos"), is(equalTo(10)));
}
@Test
@DisplayName("Test update typo tolerance settings")
public void testPartialUpdateTypoTolerance() throws Exception {
Index index = createIndex("testUpdateTypoTolerance");
TypoTolerance newTypoTolerance = new TypoTolerance();
newTypoTolerance.setDisableOnWords(new String[] {"the"});
newTypoTolerance.setDisableOnAttributes(new String[] {"title"});
index.waitForTask(index.updateTypoToleranceSettings(newTypoTolerance).getTaskUid());
TypoTolerance updatedTypoTolerance = index.getTypoToleranceSettings();
assertThat(
updatedTypoTolerance.getDisableOnWords()[0],
is(equalTo(newTypoTolerance.getDisableOnWords()[0])));
assertThat(
updatedTypoTolerance.getDisableOnAttributes()[0],
is(equalTo(newTypoTolerance.getDisableOnAttributes()[0])));
assertThat(updatedTypoTolerance.isEnabled(), is(equalTo(true)));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos(), hasKey("oneTypo"));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos().get("oneTypo"), is(equalTo(5)));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos(), hasKey("twoTypos"));
assertThat(updatedTypoTolerance.getMinWordSizeForTypos().get("twoTypos"), is(equalTo(9)));
}
@Test
@DisplayName("Test reset typo tolerance settings")
public void testResetTypoTolerance() throws Exception {
Index index = createIndex("testResetTypoTolerance");
TypoTolerance initialTypoTolerance = index.getTypoToleranceSettings();
TypoTolerance newTypoTolerance = new TypoTolerance();
newTypoTolerance.setEnabled(true);
newTypoTolerance.setDisableOnWords(new String[] {"and"});
newTypoTolerance.setDisableOnAttributes(new String[] {"title"});
HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("oneTypo", 7);
put("twoTypos", 10);
}
};
newTypoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
index.waitForTask(index.updateTypoToleranceSettings(newTypoTolerance).getTaskUid());
TypoTolerance updatedTypoTolerance = index.getTypoToleranceSettings();
index.waitForTask(index.resetTypoToleranceSettings().getTaskUid());
TypoTolerance typoToleranceAfterReset = index.getTypoToleranceSettings();
assertThat(
updatedTypoTolerance.getDisableOnWords(),
is(arrayWithSize(newTypoTolerance.getDisableOnWords().length)));
assertThat(
updatedTypoTolerance.getDisableOnAttributes(),
is(arrayWithSize(newTypoTolerance.getDisableOnAttributes().length)));
assertThat(updatedTypoTolerance.isEnabled(), is(equalTo(newTypoTolerance.isEnabled())));
assertThat(
typoToleranceAfterReset.getDisableOnWords(),
is(arrayWithSize(initialTypoTolerance.getDisableOnWords().length)));
assertThat(
typoToleranceAfterReset.getDisableOnAttributes(),
is(arrayWithSize(initialTypoTolerance.getDisableOnAttributes().length)));
assertThat(
typoToleranceAfterReset.isEnabled(), is(equalTo(initialTypoTolerance.isEnabled())));
assertThat(typoToleranceAfterReset.getMinWordSizeForTypos(), hasKey("oneTypo"));
assertThat(
typoToleranceAfterReset.getMinWordSizeForTypos().get("oneTypo"),
is(notNullValue()));
assertThat(typoToleranceAfterReset.getMinWordSizeForTypos(), hasKey("twoTypos"));
assertThat(
typoToleranceAfterReset.getMinWordSizeForTypos().get("twoTypos"),
is(notNullValue()));
}
@Test
@DisplayName("Test update disableOnNumbers tolerance settings")
public void testUpdateDisableOnNumbersTolerance() throws Exception {
Index index = createIndex("testUpdateDisableOnNumbers");
TypoTolerance defaultTypoTolerance = index.getTypoToleranceSettings();
TypoTolerance newTypoToleranceDisableOnNumbers = new TypoTolerance();
newTypoToleranceDisableOnNumbers.setDisableOnNumbers(true);
index.waitForTask(
index.updateTypoToleranceSettings(newTypoToleranceDisableOnNumbers).getTaskUid());
TypoTolerance updatedTypoTolerance = index.getTypoToleranceSettings();
assertThat(defaultTypoTolerance.getDisableOnNumbers(), is(equalTo(false)));
assertThat(updatedTypoTolerance.getDisableOnNumbers(), is(equalTo(true)));
}
/** Tests of all the specifics setting methods when null is passed */
@Test
@DisplayName("Test update synonyms settings when null is passed")
public void testUpdateSynonymsSettingsUsingNull() throws Exception {
Index index = createIndex("testUpdateSynonymsSettingsUsingNull");
Map<String, String[]> initialSynonymsSettings = index.getSynonymsSettings();
HashMap<String, String[]> newSynonymsSettings = new HashMap<>();
newSynonymsSettings.put("007", new String[] {"james bond", "bond"});
newSynonymsSettings.put("ironman", new String[] {"tony stark", "iron man"});
index.waitForTask(index.updateSynonymsSettings(newSynonymsSettings).getTaskUid());
Map<String, String[]> updatedSynonymsSettings = index.getSynonymsSettings();
index.waitForTask(index.updateSynonymsSettings(null).getTaskUid());
Map<String, String[]> resetSynonymsSettings = index.getSynonymsSettings();
assertThat(updatedSynonymsSettings, is(not(aMapWithSize(initialSynonymsSettings.size()))));
assertThat(resetSynonymsSettings, is(not(aMapWithSize(updatedSynonymsSettings.size()))));
assertThat(resetSynonymsSettings, is(aMapWithSize(initialSynonymsSettings.size())));
assertThat(resetSynonymsSettings.keySet(), is(equalTo(initialSynonymsSettings.keySet())));
}
@Test
@DisplayName("Test update stop-words settings when null is passed")
public void testUpdateStopWordsSettingsUsingNull() throws Exception {
Index index = createIndex("testUpdateStopWordsSettingsUsingNull");
String[] initialStopWords = index.getStopWordsSettings();
String[] newStopWords = {"the", "to", "in", "on"};
index.waitForTask(index.updateStopWordsSettings(newStopWords).getTaskUid());
String[] updatedStopWords = index.getStopWordsSettings();
index.waitForTask(index.updateStopWordsSettings(null).getTaskUid());
String[] resetStopWords = index.getStopWordsSettings();
assertThat(updatedStopWords, is(not(arrayWithSize(initialStopWords.length))));
assertThat(resetStopWords, is(not(arrayWithSize(updatedStopWords.length))));
assertThat(resetStopWords, is(arrayWithSize(initialStopWords.length)));
assertThat(resetStopWords, is(equalTo(initialStopWords)));
}
@Test
@DisplayName("Test reset ranking rules when null value is passed")
public void testUpdateRankingRulesSettingsUsingNull() throws Exception {
Index index = createIndex("testUpdateRankingRulesSettingsUsingNull");
String[] initialRankingRule = index.getRankingRulesSettings();
String[] newRankingRules = {
"typo",
"words",
"sort",
"proximity",
"attribute",
"exactness",
"release_date:desc",
"rank:desc"
};
index.waitForTask(index.updateRankingRulesSettings(newRankingRules).getTaskUid());
String[] newRankingRule = index.getRankingRulesSettings();
index.waitForTask(index.updateRankingRulesSettings(null).getTaskUid());
String[] resetRankingRule = index.getRankingRulesSettings();
assertThat(resetRankingRule, is(not(arrayWithSize(newRankingRule.length))));
assertThat(resetRankingRule, is(arrayWithSize(initialRankingRule.length)));
assertThat(resetRankingRule, is(equalTo(initialRankingRule)));
}
@Test
@DisplayName("Test update searchable attributes settings when null is passed")
public void testUpdateSearchableAttributesSettingssUsingNull() throws Exception {
Index index = createIndex("testUpdateSearchableAttributesSettingssUsingNull");
String[] initialSearchableAttributes = index.getSearchableAttributesSettings();
String[] newSearchableAttributes = {"title", "release_date", "cast"};
index.waitForTask(
index.updateSearchableAttributesSettings(newSearchableAttributes).getTaskUid());
String[] updatedSearchableAttributes = index.getSearchableAttributesSettings();
index.waitForTask(index.updateSearchableAttributesSettings(null).getTaskUid());
String[] resetSearchableAttributes = index.getSearchableAttributesSettings();