diff --git a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php index af477d3..a4cded4 100644 --- a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php +++ b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php @@ -202,7 +202,7 @@ public function adminSummary() { // human-readable label based on the current value. The valueOptions // array is keyed with either 0 or 1, so if the current value is not // empty, use the label for 1, and if it's empty, use the label for 0. - return $this->valueOptions[!empty($this->value)]; + return $this->operator . ' ' . $this->valueOptions[!empty($this->value)]; } public function defaultExposeOptions() { @@ -234,7 +234,7 @@ public function query() { * (optional) Either static::EQUAL or static::NOT_EQUAL. Defaults to * static::EQUAL. */ - protected function queryOpBoolean($field, $query_operator = '=') { + protected function queryOpBoolean($field, $query_operator = EQUAL) { if (empty($this->value)) { if ($this->accept_null) { if ($query_operator == static::EQUAL) { @@ -255,11 +255,16 @@ protected function queryOpBoolean($field, $query_operator = '=') { } else { if (!empty($this->definition['use_equal'])) { - $this->query->addWhere($this->options['group'], $field, 1, $query_operator); + // Forces an '=' operator instead of a '<>' for performance reasons. + if ($query_operator == static::EQUAL) { + $this->query->addWhere($this->options['group'], $field, 1, static::EQUAL); + } + else { + $this->query->addWhere($this->options['group'], $field, 0, static::EQUAL); + } } else { - $reverse_operator = $query_operator == static::EQUAL ? static::NOT_EQUAL : static::EQUAL; - $this->query->addWhere($this->options['group'], $field, 0, $reverse_operator); + $this->query->addWhere($this->options['group'], $field, 1, $query_operator); } } }