diff --git a/src/Plugin/views/filter/SearchApiLanguage.php b/src/Plugin/views/filter/SearchApiLanguage.php index 58b400e..31d1bc2 100644 --- a/src/Plugin/views/filter/SearchApiLanguage.php +++ b/src/Plugin/views/filter/SearchApiLanguage.php @@ -32,10 +32,7 @@ public function query() { // would be placed directly on the query, as an AND condition. $query = $this->getQuery(); $direct_condition = $this->operator == 'in' - && ( - empty($query->where[$this->options['group']]['type']) - || $query->where[$this->options['group']]['type'] == 'AND' - ) + && $query->getGroupType($this->options['group']) && $query->getGroupOperator() == 'AND'; if ($direct_condition) { $query->setLanguages($this->value); diff --git a/src/Plugin/views/query/SearchApiQuery.php b/src/Plugin/views/query/SearchApiQuery.php index 15499b5..51820cd 100644 --- a/src/Plugin/views/query/SearchApiQuery.php +++ b/src/Plugin/views/query/SearchApiQuery.php @@ -902,6 +902,19 @@ public function getGroupOperator() { } /** + * Returns the group type of the given group. + * + * @param int $group + * The group whose type should be retrieved. + * + * @return string + * The group type – "AND" or "OR". + */ + public function getGroupType($group) { + return !empty($this->where[$group]) ? $this->where[$group] : 'AND'; + } + + /** * Transforms a database condition to an equivalent search filter. * * @param \Drupal\Core\Database\Query\ConditionInterface $db_condition