protected function SearchApiAbstractProcessor::processFilters in Search API 7
Method for preprocessing query filters.
1 call to SearchApiAbstractProcessor::processFilters()
- SearchApiAbstractProcessor::preprocessSearchQuery in includes/
processor.inc - Calls processKeys() for the keys and processFilters() for the filters.
File
- includes/
processor.inc, line 367 - Contains SearchApiProcessorInterface and SearchApiAbstractProcessor.
Class
- SearchApiAbstractProcessor
- Abstract processor implementation that provides an easy framework for only processing specific fields.
Code
protected function processFilters(array &$filters) {
$fields = $this->index->options['fields'];
foreach ($filters as $key => &$f) {
if (is_array($f)) {
if (isset($fields[$f[0]]) && $this
->testField($f[0], $fields[$f[0]])) {
// We want to allow processors also to easily remove complete filters.
// However, we can't use empty() or the like, as that would sort out
// filters for 0 or NULL. So we specifically check only for the empty
// string, and we also make sure the filter value was actually changed
// by storing whether it was empty before.
$empty_string = $f[1] === '';
$this
->processFilterValue($f[1]);
if ($f[1] === '' && !$empty_string) {
unset($filters[$key]);
}
}
}
else {
$child_filters =& $f
->getFilters();
$this
->processFilters($child_filters);
}
}
}