These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Elastica\Query; |
||
4 | |||
5 | /** |
||
6 | * Range query. |
||
7 | * |
||
8 | * @author Nicolas Ruflin <[email protected]> |
||
9 | * |
||
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html |
||
11 | */ |
||
12 | class Range extends AbstractQuery |
||
13 | { |
||
14 | /** |
||
15 | * Constructor. |
||
16 | * |
||
17 | * @param string $fieldName Field name |
||
18 | * @param array $args Field arguments |
||
19 | */ |
||
20 | public function __construct($fieldName = null, array $args = []) |
||
21 | { |
||
22 | if ($fieldName) { |
||
0 ignored issues
–
show
|
|||
23 | $this->addField($fieldName, $args); |
||
24 | } |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Adds a range field to the query. |
||
29 | * |
||
30 | * @param string $fieldName Field name |
||
31 | * @param array $args Field arguments |
||
32 | * |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function addField($fieldName, array $args) |
||
36 | { |
||
37 | return $this->setParam($fieldName, $args); |
||
38 | } |
||
39 | } |
||
40 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: