You are here

public function Stemmer::preprocessIndexItems in Search API 8

Preprocesses search items for indexing.

Parameters

\Drupal\search_api\Item\ItemInterface[] $items: An array of items to be preprocessed for indexing.

Overrides FieldsProcessorPluginBase::preprocessIndexItems

File

src/Plugin/search_api/processor/Stemmer.php, line 104

Class

Stemmer
Stems search terms.

Namespace

Drupal\search_api\Plugin\search_api\processor

Code

public function preprocessIndexItems(array $items) {
  foreach ($items as $item) {

    // Limit this processor to English language data.
    if ($item
      ->getLanguage() !== 'en') {
      continue;
    }
    foreach ($item
      ->getFields() as $name => $field) {
      if ($this
        ->testField($name, $field)) {
        $this
          ->processField($field);
      }
    }
  }
}