public function ParagraphBundle::preIndexSave in Search API Sort Priority 8
Preprocesses the search index entity before it is saved.
This can, for example, be used to make sure fields needed by this processor are enabled on the index.
Overrides ProcessorPluginBase::preIndexSave
File
- src/
Plugin/ search_api/ processor/ ParagraphBundle.php, line 189
Class
- ParagraphBundle
- Adds customized sort priority by Paragraph Bundle.
Namespace
Drupal\search_api_sort_priority\Plugin\search_api\processorCode
public function preIndexSave() {
// Automatically add field to index if processor is enabled.
$field = $this
->ensureField(NULL, $this->targetFieldId, 'integer');
// Hide the field.
$field
->setHidden();
}