File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -438,4 +438,27 @@ public function resetFacetSearch(): array
438
438
{
439
439
return $ this ->http ->delete (self ::PATH . '/ ' . $ this ->uid . '/settings/facet-search ' );
440
440
}
441
+
442
+ // Settings - Prefix Search
443
+
444
+ /**
445
+ * @return 'indexingTime'|'disabled'
446
+ */
447
+ public function getPrefixSearch (): string
448
+ {
449
+ return $ this ->http ->get (self ::PATH . '/ ' . $ this ->uid . '/settings/prefix-search ' );
450
+ }
451
+
452
+ /**
453
+ * @param 'indexingTime'|'disabled' $prefixSearch
454
+ */
455
+ public function updatePrefixSearch (string $ prefixSearch ): array
456
+ {
457
+ return $ this ->http ->put (self ::PATH . '/ ' . $ this ->uid . '/settings/prefix-search ' , $ prefixSearch );
458
+ }
459
+
460
+ public function resetPrefixSearch (): array
461
+ {
462
+ return $ this ->http ->delete (self ::PATH . '/ ' . $ this ->uid . '/settings/prefix-search ' );
463
+ }
441
464
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Tests \Settings ;
6
+
7
+ use Tests \TestCase ;
8
+
9
+ final class PrefixSearchTest extends TestCase
10
+ {
11
+ public function testGetDefaultPrefixSearch (): void
12
+ {
13
+ $ index = $ this ->createEmptyIndex ($ this ->safeIndexName ());
14
+
15
+ $ prefixSearch = $ index ->getPrefixSearch ();
16
+
17
+ self ::assertSame ('indexingTime ' , $ prefixSearch );
18
+ }
19
+
20
+ public function testUpdatePrefixSearch (): void
21
+ {
22
+ $ index = $ this ->createEmptyIndex ($ this ->safeIndexName ());
23
+
24
+ $ promise = $ index ->updatePrefixSearch ('disabled ' );
25
+
26
+ $ this ->assertIsValidPromise ($ promise );
27
+ $ index ->waitForTask ($ promise ['taskUid ' ]);
28
+
29
+ $ prefixSearch = $ index ->getPrefixSearch ();
30
+ self ::assertSame ('disabled ' , $ prefixSearch );
31
+ }
32
+
33
+ public function testResetPrefixSearch (): void
34
+ {
35
+ $ index = $ this ->createEmptyIndex ($ this ->safeIndexName ());
36
+
37
+ $ promise = $ index ->updatePrefixSearch ('disabled ' );
38
+ $ index ->waitForTask ($ promise ['taskUid ' ]);
39
+
40
+ $ promise = $ index ->resetPrefixSearch ();
41
+
42
+ $ this ->assertIsValidPromise ($ promise );
43
+
44
+ $ index ->waitForTask ($ promise ['taskUid ' ]);
45
+
46
+ $ prefixSearch = $ index ->getPrefixSearch ();
47
+ self ::assertSame ('indexingTime ' , $ prefixSearch );
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments