public function SearchApiGranular::calculateRange in Facets 8
Calculate the range for a given facet filter value.
Used when adding active items in self::execute() to $this->query to include the range conditions for the value.
Parameters
string $value: The raw value for the facet filter.
Return value
array Keyed with 'start' and 'stop' values.
Overrides QueryTypeRangeBase::calculateRange
File
- src/
Plugin/ facets/ query_type/ SearchApiGranular.php, line 24
Class
- SearchApiGranular
- Basic support for numeric facets grouping by a granularity value.
Namespace
Drupal\facets\Plugin\facets\query_typeCode
public function calculateRange($value) {
return [
'start' => $value,
'stop' => (int) $value + $this
->getGranularity(),
];
}