You are here

public function SearchTextProcessor::process in Drupal 9

Same name and namespace in other branches
  1. 10 core/modules/search/src/SearchTextProcessor.php \Drupal\search\SearchTextProcessor::process()

Processes text into words for indexing.

Parameters

string $text: Text to process.

string|null $langcode: Language code for the language of $text, if known.

Return value

array Array of words in the simplified, preprocessed text.

Overrides SearchTextProcessorInterface::process

See also

\Drupal\search\SearchTextProcessorInterface::analyze()

File

core/modules/search/src/SearchTextProcessor.php, line 56

Class

SearchTextProcessor
Processes search text for indexing.

Namespace

Drupal\search

Code

public function process(string $text, ?string $langcode = NULL) : array {
  $text = $this
    ->analyze($text, $langcode);
  return explode(' ', $text);
}