You are here

public function Index::getProcessor in Search API 8

Retrieves a specific processor plugin for this index.

Parameters

string $processor_id: The ID of the processor plugin to return.

Return value

\Drupal\search_api\Processor\ProcessorInterface The processor plugin with the given ID.

Throws

\Drupal\search_api\SearchApiException Thrown if the specified processor isn't enabled for this index, or couldn't be loaded.

Overrides IndexInterface::getProcessor

File

src/Entity/Index.php, line 597

Class

Index
Defines the search index configuration entity.

Namespace

Drupal\search_api\Entity

Code

public function getProcessor($processor_id) {
  $processors = $this
    ->getProcessors();
  if (empty($processors[$processor_id])) {
    $index_label = $this
      ->label();
    throw new SearchApiException("The processor with ID '{$processor_id}' could not be retrieved for index '{$index_label}'.");
  }
  return $processors[$processor_id];
}