You are here

public function SnowballStemmer::preprocessIndexItems in Snowball Stemmer 8

Same name and namespace in other branches
  1. 2.x src/Plugin/search_api/processor/SnowballStemmer.php \Drupal\snowball_stemmer\Plugin\search_api\processor\SnowballStemmer::preprocessIndexItems()

Preprocesses search items for indexing.

Parameters

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

Overrides Stemmer::preprocessIndexItems

File

src/Plugin/search_api/processor/SnowballStemmer.php, line 106

Class

SnowballStemmer
Stems search terms.

Namespace

Drupal\snowball_stemmer\Plugin\search_api\processor

Code

public function preprocessIndexItems(array $items) {
  foreach ($items as $item) {
    if ($this
      ->getStemmer()
      ->setLanguage($item
      ->getLanguage())) {
      foreach ($item
        ->getFields() as $name => $field) {
        if ($this
          ->testField($name, $field)) {
          $this
            ->processField($field);
        }
      }
    }
  }
}