function SearchTextProcessorInterface::analyze

Same name and namespace in other branches
  1. 9 core/modules/search/src/SearchTextProcessorInterface.php \Drupal\search\SearchTextProcessorInterface::analyze()
  2. 10 core/modules/search/src/SearchTextProcessorInterface.php \Drupal\search\SearchTextProcessorInterface::analyze()

Runs the text through character analyzers in preparation for indexing.

Processing steps:

  • Entities are decoded.
  • Text is lower-cased and diacritics (accents) are removed.
  • hook_search_preprocess() is invoked.
  • CJK (Chinese, Japanese, Korean) characters are processed, depending on the search settings.
  • Punctuation is processed (removed or replaced with spaces, depending on where it is; see code for details).
  • Words are truncated to 50 characters maximum.

Parameters

string $text: Text to simplify.

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

Return value

string Simplified and processed text.

See also

hook_search_preprocess()

File

core/modules/search/src/SearchTextProcessorInterface.php, line 104

Class

SearchTextProcessorInterface
Processes search text for indexing.

Namespace

Drupal\search

Code

public function analyze(string $text, ?string $langcode = NULL) : string;

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.