You are here

public function SearchApiIndex::getProcessors in Search API 7

Loads all enabled processors for this index in proper order.

Return value

array All enabled processors for this index, as SearchApiProcessorInterface objects.

3 calls to SearchApiIndex::getProcessors()
SearchApiIndex::postprocessSearchResults in includes/index_entity.inc
Postprocess search results before display.
SearchApiIndex::preprocessIndexItems in includes/index_entity.inc
Preprocess data items for indexing. Data added by data alter callbacks will be available on the items.
SearchApiIndex::preprocessSearchQuery in includes/index_entity.inc
Preprocess a search query.

File

includes/index_entity.inc, line 635
Contains SearchApiIndex.

Class

SearchApiIndex
Class representing a search index.

Code

public function getProcessors() {
  if (isset($this->processors)) {
    return $this->processors;
  }
  $this->processors = array();
  if (empty($this->options['processors'])) {
    return $this->processors;
  }
  $processor_settings = $this->options['processors'];
  $infos = search_api_get_processors();
  foreach ($processor_settings as $id => $settings) {
    if (empty($settings['status'])) {
      continue;
    }
    if (empty($infos[$id]) || !class_exists($infos[$id]['class'])) {
      watchdog('search_api', t('Undefined processor @class specified in index @name', array(
        '@class' => $id,
        '@name' => $this->name,
      )), NULL, WATCHDOG_WARNING);
      continue;
    }
    $class = $infos[$id]['class'];
    $processor = new $class($this, isset($settings['settings']) ? $settings['settings'] : array());
    if (!$processor instanceof SearchApiProcessorInterface) {
      watchdog('search_api', t('Unknown processor class @class specified for processor @name', array(
        '@class' => $class,
        '@name' => $id,
      )), NULL, WATCHDOG_WARNING);
      continue;
    }
    $this->processors[$id] = $processor;
  }
  return $this->processors;
}