@@ -29,6 +29,8 @@ final class SettingsTest extends TestCase
29
29
30
30
public const DEFAULT_SEARCHABLE_ATTRIBUTES = ['* ' ];
31
31
public const DEFAULT_DISPLAYED_ATTRIBUTES = ['* ' ];
32
+ public const DEFAULT_FACET_SEARCH = true ;
33
+ public const DEFAULT_PREFIX_SEARCH = 'indexingTime ' ;
32
34
33
35
public function testGetDefaultSettings (): void
34
36
{
@@ -58,7 +60,8 @@ public function testGetDefaultSettings(): void
58
60
self ::assertEmpty ($ settingA ['sortableAttributes ' ]);
59
61
self ::assertIsIterable ($ settingA ['typoTolerance ' ]);
60
62
self ::assertSame (self ::DEFAULT_TYPO_TOLERANCE , iterator_to_array ($ settingA ['typoTolerance ' ]));
61
-
63
+ self ::assertSame (self ::DEFAULT_FACET_SEARCH , $ settingA ['facetSearch ' ]);
64
+ self ::assertSame (self ::DEFAULT_PREFIX_SEARCH , $ settingA ['prefixSearch ' ]);
62
65
self ::assertSame (self ::DEFAULT_RANKING_RULES , $ settingB ['rankingRules ' ]);
63
66
self ::assertNull ($ settingB ['distinctAttribute ' ]);
64
67
self ::assertSame (self ::DEFAULT_SEARCHABLE_ATTRIBUTES , $ settingB ['searchableAttributes ' ]);
@@ -73,6 +76,8 @@ public function testGetDefaultSettings(): void
73
76
self ::assertEmpty ($ settingB ['sortableAttributes ' ]);
74
77
self ::assertIsIterable ($ settingB ['typoTolerance ' ]);
75
78
self ::assertSame (self ::DEFAULT_TYPO_TOLERANCE , iterator_to_array ($ settingB ['typoTolerance ' ]));
79
+ self ::assertSame (self ::DEFAULT_FACET_SEARCH , $ settingB ['facetSearch ' ]);
80
+ self ::assertSame (self ::DEFAULT_PREFIX_SEARCH , $ settingB ['prefixSearch ' ]);
76
81
}
77
82
78
83
public function testUpdateSettings (): void
@@ -82,6 +87,8 @@ public function testUpdateSettings(): void
82
87
'distinctAttribute ' => 'title ' ,
83
88
'rankingRules ' => ['title:asc ' , 'typo ' ],
84
89
'stopWords ' => ['the ' ],
90
+ 'facetSearch ' => false ,
91
+ 'prefixSearch ' => 'disabled ' ,
85
92
]);
86
93
$ this ->assertIsValidPromise ($ promise );
87
94
$ index ->waitForTask ($ promise ['taskUid ' ]);
@@ -102,6 +109,8 @@ public function testUpdateSettings(): void
102
109
self ::assertIsArray ($ settings ['sortableAttributes ' ]);
103
110
self ::assertEmpty ($ settings ['sortableAttributes ' ]);
104
111
self ::assertSame (self ::DEFAULT_TYPO_TOLERANCE , iterator_to_array ($ settings ['typoTolerance ' ]));
112
+ self ::assertSame (false , $ settings ['facetSearch ' ]);
113
+ self ::assertSame ('disabled ' , $ settings ['prefixSearch ' ]);
105
114
}
106
115
107
116
public function testUpdateSettingsWithoutOverwritingThem (): void
@@ -184,6 +193,8 @@ public function testResetSettings(): void
184
193
self ::assertIsArray ($ settings ['sortableAttributes ' ]);
185
194
self ::assertEmpty ($ settings ['sortableAttributes ' ]);
186
195
self ::assertSame (self ::DEFAULT_TYPO_TOLERANCE , iterator_to_array ($ settings ['typoTolerance ' ]));
196
+ self ::assertSame (self ::DEFAULT_FACET_SEARCH , $ settings ['facetSearch ' ]);
197
+ self ::assertSame (self ::DEFAULT_PREFIX_SEARCH , $ settings ['prefixSearch ' ]);
187
198
}
188
199
189
200
// Here the test to prevent https://github.com/meilisearch/meilisearch-php/issues/204.
0 commit comments