Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
25 | public function suggest(string $q, int $limit = 5): SuggesterResults |
||
26 | { |
||
27 | $params = [ |
||
28 | 'index' => $this->index, |
||
29 | 'body' => [ |
||
30 | 'query'=>$q, |
||
31 | 'options' => [ |
||
32 | 'limit' => $limit, |
||
33 | ], |
||
34 | ], |
||
35 | ]; |
||
36 | |||
37 | $response = $this->client->getConnection()->suggest($params); |
||
38 | |||
39 | $results = new SuggesterResults(); |
||
40 | $results->setResults(\array_keys($response)); |
||
41 | $results->setIndex($this->index); |
||
42 | $results->setQuery($q); |
||
43 | $results->setLimit($limit); |
||
44 | |||
45 | return $results; |
||
46 | } |
||
48 |