Commit 949ca4a 1 parent 5003deb commit 949ca4a Copy full SHA for 949ca4a
File tree 3 files changed +15
-0
lines changed
3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -468,6 +468,9 @@ $searchParameters->explain(true);
468
468
// set maximum number of documents to collect for each shard
469
469
$searchParameters->terminateAfter(10);
470
470
471
+ // enable caching
472
+ $searchParameters->requestCache(true);
473
+
471
474
// perform the search and get the result
472
475
$searchResult = $documentManager->search($searchParameters);
473
476
Original file line number Diff line number Diff line change @@ -158,6 +158,12 @@ public function terminateAfter(int $terminateAfter): self
158
158
return $ this ;
159
159
}
160
160
161
+ public function requestCache (bool $ requestCache ): self
162
+ {
163
+ $ this ->params ['request_cache ' ] = $ requestCache ;
164
+ return $ this ;
165
+ }
166
+
161
167
public function toArray (): array
162
168
{
163
169
return $ this ->params ;
Original file line number Diff line number Diff line change @@ -400,4 +400,10 @@ public function test_array_casting_with_terminate_after(): void
400
400
$ searchParameters = (new SearchParameters ())->terminateAfter (10 );
401
401
$ this ->assertSame (['terminate_after ' => 10 ], $ searchParameters ->toArray ());
402
402
}
403
+
404
+ public function test_array_casting_with_request_cache (): void
405
+ {
406
+ $ searchParameters = (new SearchParameters ())->requestCache (true );
407
+ $ this ->assertSame (['request_cache ' => true ], $ searchParameters ->toArray ());
408
+ }
403
409
}
You can’t perform that action at this time.
0 commit comments