@@ -62,12 +62,9 @@ public function getType()
62
62
*
63
63
* @return BoolAnd
64
64
*/
65
- public function bool_and (array $ filters )
65
+ public function bool_and (array $ filters = array () )
66
66
{
67
- $ and = new BoolAnd ();
68
- $ and ->setFilters ($ filters );
69
-
70
- return $ and ;
67
+ return new BoolAnd ($ filters );
71
68
}
72
69
73
70
/**
@@ -101,14 +98,14 @@ public function exists($field)
101
98
*
102
99
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-filter.html
103
100
*
104
- * @param string $field
101
+ * @param string $key
105
102
* @param array $coordinates
106
103
*
107
104
* @return GeoBoundingBox
108
105
*/
109
- public function geo_bounding_box ($ field , array $ coordinates )
106
+ public function geo_bounding_box ($ key , array $ coordinates )
110
107
{
111
- return new GeoBoundingBox ($ field , $ coordinates );
108
+ return new GeoBoundingBox ($ key , $ coordinates );
112
109
}
113
110
114
111
/**
@@ -197,16 +194,16 @@ public function geo_shape_pre_indexed($path, $indexedId, $indexedType, $indexedI
197
194
*
198
195
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geohash-cell-filter.html
199
196
*
200
- * @param string $field The field on which to filter
197
+ * @param string $key The field on which to filter
201
198
* @param array|string $location Location as coordinates array or geohash string ['lat' => 40.3, 'lon' => 45.2]
202
199
* @param int|string $precision length of geohash prefix or distance (3, or "50m")
203
200
* @param bool $neighbors If true, filters cells next to the given cell.
204
201
*
205
202
* @return GeohashCell
206
203
*/
207
- public function geohash_cell ($ field , $ location , $ precision = -1 , $ neighbors = false )
204
+ public function geohash_cell ($ key , $ location , $ precision = -1 , $ neighbors = false )
208
205
{
209
- return new GeohashCell ($ field , $ location , $ precision , $ neighbors );
206
+ return new GeohashCell ($ key , $ location , $ precision , $ neighbors );
210
207
}
211
208
212
209
/**
@@ -219,7 +216,7 @@ public function geohash_cell($field, $location, $precision = -1, $neighbors = fa
219
216
*
220
217
* @return HasChild
221
218
*/
222
- public function has_child ($ query , $ type )
219
+ public function has_child ($ query , $ type = null )
223
220
{
224
221
return new HasChild ($ query , $ type );
225
222
}
@@ -249,7 +246,7 @@ public function has_parent($query, $type)
249
246
*
250
247
* @return Ids
251
248
*/
252
- public function ids ($ type , array $ ids )
249
+ public function ids ($ type = null , array $ ids = array () )
253
250
{
254
251
return new Ids ($ type , $ ids );
255
252
}
@@ -304,7 +301,7 @@ public function match_all()
304
301
*
305
302
* @return Missing
306
303
*/
307
- public function missing ($ field )
304
+ public function missing ($ field = '' )
308
305
{
309
306
return new Missing ($ field );
310
307
}
@@ -340,11 +337,14 @@ public function bool_not(AbstractFilter $filter)
340
337
*
341
338
* @link http://www.elastic.co/guide/en/elasticsearch/reference/0.90/query-dsl-numeric-range-filter.html
342
339
*
340
+ * @param string $fieldName Field name
341
+ * @param array $args Field arguments
342
+ *
343
343
* @return NumericRange
344
344
*/
345
- public function numeric_range ()
345
+ public function numeric_range ($ fieldName = '' , array $ args = array () )
346
346
{
347
- return new NumericRange ();
347
+ return new NumericRange ($ fieldName , $ args );
348
348
}
349
349
350
350
/**
@@ -356,12 +356,9 @@ public function numeric_range()
356
356
*
357
357
* @return BoolOr
358
358
*/
359
- public function bool_or ($ filters )
359
+ public function bool_or (array $ filters = array () )
360
360
{
361
- $ or = new BoolOr ();
362
- $ or ->setFilters ($ filters );
363
-
364
- return $ or ;
361
+ return new BoolOr ($ filters );
365
362
}
366
363
367
364
/**
@@ -374,7 +371,7 @@ public function bool_or($filters)
374
371
*
375
372
* @return Prefix
376
373
*/
377
- public function prefix ($ field , $ prefix )
374
+ public function prefix ($ field = '' , $ prefix = '' )
378
375
{
379
376
return new Prefix ($ field , $ prefix );
380
377
}
@@ -384,11 +381,11 @@ public function prefix($field, $prefix)
384
381
*
385
382
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-filter.html
386
383
*
387
- * @param AbstractQuery $query
384
+ * @param array| AbstractQuery $query
388
385
*
389
386
* @return QueryFilter
390
387
*/
391
- public function query (AbstractQuery $ query )
388
+ public function query ($ query = null )
392
389
{
393
390
return new QueryFilter ($ query );
394
391
}
@@ -403,7 +400,7 @@ public function query(AbstractQuery $query)
403
400
*
404
401
* @return Range
405
402
*/
406
- public function range ($ fieldName , array $ args )
403
+ public function range ($ fieldName = '' , array $ args = array () )
407
404
{
408
405
return new Range ($ fieldName , $ args );
409
406
}
@@ -413,14 +410,15 @@ public function range($fieldName, array $args)
413
410
*
414
411
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-filter.html
415
412
*
416
- * @param string $field
417
- * @param string $regexp
413
+ * @param string $field Field name
414
+ * @param string $regexp Regular expression
415
+ * @param array $options Regular expression options
418
416
*
419
417
* @return Regexp
420
418
*/
421
- public function regexp ($ field , $ regexp )
419
+ public function regexp ($ field = '' , $ regexp = '' , $ options = array () )
422
420
{
423
- return new Regexp ($ field , $ regexp );
421
+ return new Regexp ($ field , $ regexp, $ options );
424
422
}
425
423
426
424
/**
@@ -432,7 +430,7 @@ public function regexp($field, $regexp)
432
430
*
433
431
* @return Script
434
432
*/
435
- public function script ($ script )
433
+ public function script ($ script = null )
436
434
{
437
435
return new Script ($ script );
438
436
}
@@ -456,14 +454,14 @@ public function term(array $term = array())
456
454
*
457
455
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-filter.html
458
456
*
459
- * @param string $field
457
+ * @param string $key
460
458
* @param array $terms
461
459
*
462
460
* @return Terms
463
461
*/
464
- public function terms ($ field , array $ terms )
462
+ public function terms ($ key = '' , array $ terms = array () )
465
463
{
466
- return new Terms ($ field , $ terms );
464
+ return new Terms ($ key , $ terms );
467
465
}
468
466
469
467
/**
@@ -475,7 +473,7 @@ public function terms($field, array $terms)
475
473
*
476
474
* @return Type
477
475
*/
478
- public function type ($ type )
476
+ public function type ($ type = null )
479
477
{
480
478
return new Type ($ type );
481
479
}
0 commit comments