Conditions | 2 |
Paths | 2 |
Total Lines | 28 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
34 | public function buildSearch(string $index, string $type) : array |
||
35 | { |
||
36 | $search = [ |
||
37 | 'index' => $index, |
||
38 | 'type' => $type, |
||
39 | 'body' => [ |
||
40 | 'from' => $this->from, |
||
41 | 'size' => $this->size, |
||
42 | 'query' => [ |
||
43 | 'bool' => [ |
||
44 | 'must' => [ |
||
45 | [ |
||
46 | 'match' => [ |
||
47 | 'user_id' => $this->userId, |
||
48 | ], |
||
49 | ], |
||
50 | ], |
||
51 | ], |
||
52 | ], |
||
53 | ], |
||
54 | ]; |
||
55 | |||
56 | if (!empty($this->status)) { |
||
57 | $search['body']['query']['bool']['must'][]['match']['status'] = $this->status; |
||
58 | } |
||
59 | |||
60 | return $search; |
||
61 | } |
||
62 | } |
||
63 |