You are here

public function SearchApiQueryFilter::condition in Search API 7

Adds a new ($field $operator $value) condition.

Parameters

string $field: The field to filter on, e.g. 'title'.

mixed $value: The value the field should have (or be related to by the operator).

string $operator: The operator to use for checking the constraint. The following operators are supported for primitive types: "=", "<>", "<", "<=", ">=", ">". They have the same semantics as the corresponding SQL operators. If $field is a fulltext field, $operator can only be "=" or "<>", which are in this case interpreted as "contains" or "doesn't contain", respectively. If $value is NULL, $operator also can only be "=" or "<>", meaning the field must have no or some value, respectively.

Return value

SearchApiQueryFilterInterface The called object.

Overrides SearchApiQueryFilterInterface::condition

File

includes/query.inc, line 1044
Contains SearchApiQueryInterface and SearchApiQuery.

Class

SearchApiQueryFilter
Provides a standard implementation of SearchApiQueryFilterInterface.

Code

public function condition($field, $value, $operator = '=') {
  $this->filters[] = array(
    $field,
    $value,
    $operator,
  );
  return $this;
}