You are here

public function MediaBundle::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/MediaBundle.php, line 190

Class

MediaBundle
Adds customized sort priority by Media Bundle.

Namespace

Drupal\search_api_sort_priority\Plugin\search_api\processor

Code

public function preIndexSave() {

  // Automatically add field to index if processor is enabled.
  $field = $this
    ->ensureField(NULL, $this->targetFieldId, 'integer');

  // Hide the field.
  $field
    ->setHidden();
}