src/Query.php
public function where($name, $operator = "=", $value = NULL)
    {

        if (is_callback_function($name)) {
            $name($this);
            return $this;
        }

        if (!$this->isOperator($operator)) {
            $value = $operator;
            $operator = "=";
        }

        if ($operator == "=") {

            if ($name == "_id") {
                return $this->_id($value);
            }

            $this->filter[] = ["term" => [$name => $value]];
        }

        if ($operator == ">") {
            $this->filter[] = ["range" => [$name => ["gt" => $value]]];
        }

        if ($operator == ">=") {
            $this->filter[] = ["range" => [$name => ["gte" => $value]]];
        }

        if ($operator == "<") {
            $this->filter[] = ["range" => [$name => ["lt" => $value]]];
        }

        if ($operator == "<=") {
            $this->filter[] = ["range" => [$name => ["lte" => $value]]];
        }

        if ($operator == "like") {
            $this->must[] = ["match" => [$name => $value]];
        }

        if ($operator == "exists") {
            $this->whereExists($name, $value);
        }

        return $this;
    }
public function where($name, $operator = "=", $value = NULL)
    {

        if (is_callback_function($name)) {
            $name($this);
            return $this;
        }

        if (!$this->isOperator($operator)) {
            $value = $operator;
            $operator = "=";
        }

        if ($operator == "=") {

            if ($name == "_id") {
                return $this->_id($value);
            }

            $this->filter[] = ["term" => [$name => $value]];
        }

        if ($operator == ">") {
            $this->filter[] = ["range" => [$name => ["gt" => $value]]];
        }

        if ($operator == ">=") {
            $this->filter[] = ["range" => [$name => ["gte" => $value]]];
        }

        if ($operator == "<") {
            $this->filter[] = ["range" => [$name => ["lt" => $value]]];
        }

        if ($operator == "<=") {
            $this->filter[] = ["range" => [$name => ["lte" => $value]]];
        }

        if ($operator == "like") {
            $this->must[] = ["match" => [$name => $value]];
        }

        if ($operator == "exists") {
            $this->whereExists($name, $value);
        }

        return $this;
    }
public function where ( $ name , $ operator = "=" , $ value = NULL ) { if ( is_callback_function ( $ name ) ) { $ name ( $ this ) ; return $ this ; } if ( ! $ this -> isOperator ( $ operator ) ) { $ value = $ operator ; $ operator = "=" ; } if ( $ operator == "=" ) { if ( $ name == "_id" ) { return $ this -> _id ( $ value ) ; } $ this -> filter [ ] = [ "term" => [ $ name => $ value ] ] ; } if ( $ operator == ">" ) { $ this -> filter [ ] = [ "range" => [ $ name => [ "gt" => $ value ] ] ] ; } if ( $ operator == ">=" ) { $ this -> filter [ ] = [ "range" => [ $ name => [ "gte" => $ value ] ] ] ; } if ( $ operator == "<" ) { $ this -> filter [ ] = [ "range" => [ $ name => [ "lt" => $ value ] ] ] ; } if ( $ operator == "<=" ) { $ this -> filter [ ] = [ "range" => [ $ name => [ "lte" => $ value ] ] ] ; } if ( $ operator == "like" ) { $ this -> must [ ] = [ "match" => [ $ name => $ value ] ] ; } if ( $ operator == "exists" ) { $ this -> whereExists ( $ name , $ value ) ; } return $ this ; }
Set the query where clause
@param        $name
@param string $operator
@param null $value
@return $this
Set the query where clause