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);
}