1 | <?php |
||
8 | class QueryBuilder implements IQueryBuilder |
||
9 | { |
||
10 | protected $query = [ |
||
11 | 'body' => [], |
||
12 | 'from' => 0, |
||
13 | 'size' => 0 |
||
14 | ]; |
||
15 | |||
16 | public function __construct(array $body = []) |
||
20 | |||
21 | public function from(int $from): self |
||
26 | |||
27 | public function size(int $size): self |
||
32 | |||
33 | 1 | public function hasSort(): bool |
|
37 | |||
38 | /** |
||
39 | * @param array|string $sort |
||
40 | * @return $this |
||
41 | 2 | */ |
|
42 | public function sort($sort) |
||
47 | |||
48 | /** |
||
49 | * @param Filter|array $filter |
||
50 | * @param string $mode |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function filter($filter = [], $mode = Filter::MODE_INCLUDE) |
||
76 | |||
77 | 5 | /** |
|
78 | 5 | * Set _source to search query. |
|
79 | 5 | * |
|
80 | * @param mixed $fields |
||
81 | * @return $this |
||
82 | 5 | */ |
|
83 | 5 | public function fields($fields = false) |
|
94 | |||
95 | /** |
||
96 | * Return only _id. |
||
97 | * |
||
98 | * @return $this |
||
99 | */ |
||
100 | 1 | public function getOnlyIds() |
|
104 | 1 | ||
105 | public function build(): array |
||
109 | 1 | ||
110 | /** |
||
111 | * @return string |
||
112 | */ |
||
113 | public function __toString() |
||
117 | |||
118 | /** |
||
119 | * @param int $options |
||
120 | * @return string |
||
121 | */ |
||
122 | public function toJson($options = 0) |
||
126 | |||
127 | 7 | protected function merge(array $query, $mode = 'must') |
|
137 | 7 | ||
138 | public function aggregation(Aggregation $aggregation) |
||
143 | |||
144 | public function where($field, $value) |
||
150 | |||
151 | public function notWhere($field, $value) |
||
157 | |||
158 | public function orWhere($field, $value) |
||
164 | |||
165 | 5 | public function between($field, $start, $end) |
|
171 | |||
172 | 1 | public function betweenOrEquals($field, $start, $end) |
|
178 | |||
179 | public function range($field, $start, $end) |
||
183 | |||
184 | public function greaterThan($field, $start) |
||
190 | |||
191 | public function gt($field, $start) |
||
195 | |||
196 | public function greaterThanOrEquals($field, $start) |
||
202 | |||
203 | public function gte($field, $start) |
||
207 | 1 | ||
208 | 1 | public function lessThan($field, $end) |
|
214 | |||
215 | public function lt($field, $start) |
||
219 | 1 | ||
220 | 1 | public function lessThanOrEquals($field, $end) |
|
226 | |||
227 | public function lte($field, $start) |
||
231 | |||
232 | public function match($field, $value) |
||
238 | |||
239 | public function notMatch($field, $value) |
||
245 | |||
246 | public function orMatch($field, $value) |
||
252 | } |
||
253 |