Total Complexity | 4 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
11 | class ElasticsearchDsl implements ElasticsearchDslContract |
||
12 | { |
||
13 | /** |
||
14 | * Get es client |
||
15 | * |
||
16 | * @return Client |
||
17 | */ |
||
18 | 1 | public function getEsClient(): Client |
|
19 | { |
||
20 | 1 | return $this->getElasticsearch()->getClient(); |
|
21 | } |
||
22 | |||
23 | 1 | private function getElasticsearch() : ElasticsearchContract |
|
24 | { |
||
25 | 1 | return app(ElasticsearchContract::class); |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * Search |
||
30 | * |
||
31 | * @param OngrSearch|null $search |
||
32 | * @param string|null $esIndex |
||
33 | * @param string|null $esType |
||
34 | * @return Search |
||
35 | */ |
||
36 | 14 | public function search( |
|
37 | ?OngrSearch $search = null, |
||
38 | ?string $esIndex = null, |
||
39 | ?string $esType = null |
||
40 | ): Search { |
||
41 | 14 | return app()->makeWith(Search::class, [ |
|
42 | 14 | 'search' => $search, |
|
43 | 14 | 'esIndex' => $esIndex, |
|
44 | 14 | 'esType' => $esType |
|
45 | ]); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Suggestion |
||
50 | * |
||
51 | * @param OngrSearch|null $search |
||
52 | * @return Suggestion |
||
53 | */ |
||
54 | 3 | public function suggest(?OngrSearch $search = null): Suggestion |
|
58 | ]); |
||
59 | } |
||
60 | } |
||
61 |