public function SearchApiAttachmentsFilterPlugin::query in Search API attachments 8
Same name and namespace in other branches
- 9.0.x src/Plugin/views/filter/SearchApiAttachmentsFilterPlugin.php \Drupal\search_api_attachments\Plugin\views\filter\SearchApiAttachmentsFilterPlugin::query()
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides BooleanOperator::query
File
- src/
Plugin/ views/ filter/ SearchApiAttachmentsFilterPlugin.php, line 19
Class
- SearchApiAttachmentsFilterPlugin
- Excludes/Includes search in attachments too.
Namespace
Drupal\search_api_attachments\Plugin\views\filterCode
public function query() {
if (!$this->value) {
return;
}
$fields = $this->query
->getFulltextFields();
if (!empty($fields)) {
foreach ($fields as $key => $field_name) {
$prefix = 'saa_';
if (strpos($field_name, $prefix) === 0) {
unset($fields[$key]);
}
}
$this->query
->setFulltextFields($fields);
}
}