8
8
class FilterBuilder extends Builder
9
9
{
10
10
/**
11
+ * The condition array.
12
+ *
11
13
* @var array
12
14
*/
13
15
public $ wheres = [
14
16
'must ' => [],
15
- 'must_not ' => []
17
+ 'must_not ' => [],
16
18
];
17
19
18
20
/**
21
+ * The with array.
22
+ *
19
23
* @var array|string
20
24
*/
21
25
public $ with ;
22
26
23
27
/**
28
+ * The offset
29
+ *
24
30
* @var int
25
31
*/
26
32
public $ offset ;
27
33
28
34
/**
35
+ * The collapse parameter.
36
+ *
29
37
* @var string
30
38
*/
31
39
public $ collapse ;
32
40
33
41
/**
42
+ * The select array.
43
+ *
34
44
* @var array
35
45
*/
36
46
public $ select = [];
37
47
38
48
/**
39
- * @param Model $model
49
+ * FilterBuilder constructor.
50
+ *
51
+ * @param \Illuminate\Database\Eloquent\Model $model
40
52
* @param callable|null $callback
41
53
* @param bool $softDelete
54
+ * @return void
42
55
*/
43
56
public function __construct (Model $ model , $ callback = null , $ softDelete = false )
44
57
{
@@ -55,6 +68,8 @@ public function __construct(Model $model, $callback = null, $softDelete = false)
55
68
}
56
69
57
70
/**
71
+ * Add a where condition.
72
+ *
58
73
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html Term query
59
74
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
60
75
*
@@ -136,6 +151,8 @@ public function where($field, $value)
136
151
}
137
152
138
153
/**
154
+ * Add a whereIn condition.
155
+ *
139
156
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html Terms query
140
157
*
141
158
* @param string $field
@@ -154,6 +171,8 @@ public function whereIn($field, array $value)
154
171
}
155
172
156
173
/**
174
+ * Add a whereNotIn condition.
175
+ *
157
176
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html Terms query
158
177
*
159
178
* @param string $field
@@ -172,6 +191,8 @@ public function whereNotIn($field, array $value)
172
191
}
173
192
174
193
/**
194
+ * Add a whereBetween condition.
195
+ *
175
196
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
176
197
*
177
198
* @param string $field
@@ -193,6 +214,8 @@ public function whereBetween($field, array $value)
193
214
}
194
215
195
216
/**
217
+ * Add a whereNotBetween condition.
218
+ *
196
219
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
197
220
*
198
221
* @param string $field
@@ -214,6 +237,8 @@ public function whereNotBetween($field, array $value)
214
237
}
215
238
216
239
/**
240
+ * Add a whereExists condition.
241
+ *
217
242
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html Exists query
218
243
*
219
244
* @param string $field
@@ -231,6 +256,8 @@ public function whereExists($field)
231
256
}
232
257
233
258
/**
259
+ * Add a whereNotExists condition
260
+ *
234
261
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html Exists query
235
262
*
236
263
* @param string $field
@@ -248,6 +275,8 @@ public function whereNotExists($field)
248
275
}
249
276
250
277
/**
278
+ * Add a whereRegexp condition.
279
+ *
251
280
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html Regexp query
252
281
*
253
282
* @param string $field
@@ -270,6 +299,8 @@ public function whereRegexp($field, $value, $flags = 'ALL')
270
299
}
271
300
272
301
/**
302
+ * Add a whereGeoDistance condition.
303
+ *
273
304
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html Geo distance query
274
305
*
275
306
* @param string $field
@@ -290,6 +321,8 @@ public function whereGeoDistance($field, $value, $distance)
290
321
}
291
322
292
323
/**
324
+ * Add a whereGeoBoundingBox condition.
325
+ *
293
326
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html Geo bounding box query
294
327
*
295
328
* @param string $field
@@ -308,6 +341,8 @@ public function whereGeoBoundingBox($field, array $value)
308
341
}
309
342
310
343
/**
344
+ * Add a whereGeoPolygon condition.
345
+ *
311
346
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-query.html Geo polygon query
312
347
*
313
348
* @param string $field
@@ -326,8 +361,10 @@ public function whereGeoPolygon($field, array $points)
326
361
327
362
return $ this ;
328
363
}
329
-
364
+
330
365
/**
366
+ * Add a whereGeoShape condition.
367
+ *
331
368
* @see https://www.elastic.co/guide/en/elasticsearch/guide/current/querying-geo-shapes.html Querying Geo Shapes
332
369
*
333
370
* @param string $field
@@ -346,8 +383,10 @@ public function whereGeoShape($field, array $shape)
346
383
347
384
return $ this ;
348
385
}
349
-
386
+
350
387
/**
388
+ * Add a orderBy clause.
389
+ *
351
390
* @param string $field
352
391
* @param string $direction
353
392
* @return $this
@@ -362,6 +401,8 @@ public function orderBy($field, $direction = 'asc')
362
401
}
363
402
364
403
/**
404
+ * Explain the request.
405
+ *
365
406
* @return array
366
407
*/
367
408
public function explain ()
@@ -372,6 +413,8 @@ public function explain()
372
413
}
373
414
374
415
/**
416
+ * Profile the request.
417
+ *
375
418
* @return array
376
419
*/
377
420
public function profile ()
@@ -382,6 +425,8 @@ public function profile()
382
425
}
383
426
384
427
/**
428
+ * Build the payload.
429
+ *
385
430
* @return array
386
431
*/
387
432
public function buildPayload ()
@@ -392,6 +437,8 @@ public function buildPayload()
392
437
}
393
438
394
439
/**
440
+ * Eager load some some relations.
441
+ *
395
442
* @param array|string $relations
396
443
* @return $this
397
444
*/
@@ -403,6 +450,8 @@ public function with($relations)
403
450
}
404
451
405
452
/**
453
+ * Set the query offset.
454
+ *
406
455
* @param int $offset
407
456
* @return $this
408
457
*/
@@ -444,6 +493,8 @@ public function paginate($perPage = null, $pageName = 'page', $page = null)
444
493
}
445
494
446
495
/**
496
+ * Collapse by a field.
497
+ *
447
498
* @param string $field
448
499
* @return $this
449
500
*/
@@ -455,6 +506,8 @@ public function collapse(string $field)
455
506
}
456
507
457
508
/**
509
+ * Select one or many fields.
510
+ *
458
511
* @param mixed $fields
459
512
* @return $this
460
513
*/
@@ -469,6 +522,8 @@ public function select($fields)
469
522
}
470
523
471
524
/**
525
+ * Get the count.
526
+ *
472
527
* @return int
473
528
*/
474
529
public function count ()
0 commit comments