You are here

public function SearchApiQuery::addConditionGroup in Search API 8

Adds a nested condition group.

If $group is given, the filter is added to the relevant filter group instead.

Parameters

\Drupal\search_api\Query\ConditionGroupInterface $condition_group: A condition group that should be added.

string|null $group: (optional) The Views query filter group to add this filter to.

Return value

$this

See also

\Drupal\search_api\Query\QueryInterface::addConditionGroup()

File

src/Plugin/views/query/SearchApiQuery.php, line 991

Class

SearchApiQuery
Defines a Views query class for searching on Search API indexes.

Namespace

Drupal\search_api\Plugin\views\query

Code

public function addConditionGroup(ConditionGroupInterface $condition_group, $group = NULL) {
  if (!$this
    ->shouldAbort()) {

    // Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all
    // the default group.
    if (empty($group)) {
      $group = 0;
    }
    $this->where[$group]['condition_groups'][] = $condition_group;
  }
  return $this;
}