function search_simplify
Same name in other branches
- 7.x modules/search/search.module \search_simplify()
- 8.9.x core/modules/search/search.module \search_simplify()
Simplifies and preprocesses text for searching.
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: Language code for the language of $text, if known.
Return value
string Simplified and processed text.
Deprecated
in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Drupal\search\SearchTextProcessorInterface::analyze() instead.
See also
https://www.drupal.org/node/3078162
1 call to search_simplify()
- SearchDeprecationTest::testDeprecatedSimplify in core/
modules/ search/ tests/ src/ Kernel/ SearchDeprecationTest.php
File
-
core/
modules/ search/ search.module, line 152
Code
function search_simplify($text, $langcode = NULL) {
@trigger_error('search_simplify() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \\Drupal\\search\\SearchTextProcessorInterface::analyze() instead. See https://www.drupal.org/node/3078162', E_USER_DEPRECATED);
return \Drupal::service('search.text_processor')->analyze($text, $langcode);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.