You are here

public function Index::addProcessor in Search API 8

Adds a processor to this index.

An existing processor with the same ID will be replaced.

Parameters

\Drupal\search_api\Processor\ProcessorInterface $processor: The processor to be added.

Return value

$this

Overrides IndexInterface::addProcessor

File

src/Entity/Index.php, line 611

Class

Index
Defines the search index configuration entity.

Namespace

Drupal\search_api\Entity

Code

public function addProcessor(ProcessorInterface $processor) {

  // Make sure the processorInstances are loaded before trying to add a plugin
  // to them.
  if ($this->processorInstances === NULL) {
    $this
      ->getProcessors();
  }
  $this->processorInstances[$processor
    ->getPluginId()] = $processor;
  return $this;
}