summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Filter/Missing.php
blob: 9b157b2c80d41d5e9055db4a8e4d0f32a90c4d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Elastica\Filter;

/**
 * Missing Filter.
 *
 * @author Maciej Wiercinski <maciej@wiercinski.net>
 *
 * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-missing-filter.html
 */
class Missing extends AbstractFilter
{
    /**
     * Construct missing filter.
     *
     * @param string $field OPTIONAL
     */
    public function __construct($field = '')
    {
        if (strlen($field)) {
            $this->setField($field);
        }
    }

    /**
     * Set field.
     *
     * @param string $field
     *
     * @return $this
     */
    public function setField($field)
    {
        return $this->setParam('field', (string) $field);
    }

    /**
     * Set "existence" parameter.
     *
     * @param bool $existence
     *
     * @return $this
     */
    public function setExistence($existence)
    {
        return $this->setParam('existence', (bool) $existence);
    }

    /**
     * Set "null_value" parameter.
     *
     * @param bool $nullValue
     *
     * @return $this
     */
    public function setNullValue($nullValue)
    {
        return $this->setParam('null_value', (bool) $nullValue);
    }
}