- Issue created by @a.dmitriiev
- Status changed to Needs review
about 1 year ago 12:35pm 25 March 2024
Between operator in this module doesn't include lower and upper values. But search_api assumes they should be included see src/Plugin/views/filter/SearchApiString.php
from search_api module:
/**
* {@inheritdoc}
*/
protected function opBetween($field) {
// The parent implementation in NumericFilter uses is_numeric() checks now,
// so we need to override it to check for any values.
if ($this->value['min'] != '' && $this->value['max'] != '') {
$operator = $this->operator == 'between' ? 'BETWEEN' : 'NOT BETWEEN';
$this->getQuery()->addWhere($this->options['group'], $field, [
$this->value['min'],
$this->value['max'],
], $operator);
}
elseif ($this->value['min'] != '') {
$operator = $this->operator == 'between' ? '>=' : '<';
$this->getQuery()->addWhere($this->options['group'], $field, $this->value['min'], $operator);
}
elseif ($this->value['max'] != '') {
$operator = $this->operator == 'between' ? '<=' : '>';
$this->getQuery()->addWhere($this->options['group'], $field, $this->value['max'], $operator);
}
}
Create a query with between operator, for example use facet range slider. Observe that results with the max and min values from range are not included
Include lower and upper values in filter query statement.
Needs review
7.0
Code