Cake\ElasticSearch\FilterBuilder::_parseFilter PHP Метод

_parseFilter() защищенный Метод

Parses a field name containing an operator into a Filter object.
protected _parseFilter ( string $field, mixed $value ) : Elastica\Filter\AbstractFilter
$field string The filed name containing the operator
$value mixed The value to pass to the filter
Результат Elastica\Filter\AbstractFilter
    protected function _parseFilter($field, $value)
    {
        $operator = '=';
        $parts = explode(' ', trim($field), 2);
        if (count($parts) > 1) {
            list($field, $operator) = $parts;
        }
        $operator = strtolower(trim($operator));
        if ($operator === '>') {
            return $this->gt($field, $value);
        }
        if ($operator === '>=') {
            return $this->gte($field, $value);
        }
        if ($operator === '<') {
            return $this->lt($field, $value);
        }
        if ($operator === '<=') {
            return $this->lte($field, $value);
        }
        if (in_array($operator, ['in', 'not in'])) {
            $value = (array) $value;
        }
        if ($operator === 'in') {
            return $this->terms($field, $value);
        }
        if ($operator === 'not in') {
            return $this->not($this->terms($field, $value));
        }
        if ($operator === 'is' && $value === null) {
            return $this->missing($field);
        }
        if ($operator === 'is not' && $value === null) {
            return $this->exists($field);
        }
        if ($operator === 'is' && $value !== null) {
            return $this->term($field, $value);
        }
        if ($operator === 'is not' && $value !== null) {
            return $this->not($this->term($field, $value));
        }
        if ($operator === '!=') {
            return $this->not($this->term($field, $value));
        }
        return $this->term($field, $value);
    }