You are here

public function SearchApiQuery::condition in Search API 7

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

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

SearchApiQueryInterface The called object.

Overrides SearchApiQueryInterface::condition

1 call to SearchApiQuery::condition()
SearchApiQuery::addLanguages in includes/query.inc
Adds language filters for the query.

File

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

Class

SearchApiQuery
Provides a standard implementation of the SearchApiQueryInterface.

Code

public function condition($field, $value, $operator = '=') {
  $this->filter
    ->condition($field, $value, $operator);
  return $this;
}