function search_simplify in Drupal 9
Same name and namespace in other branches
- 8 core/modules/search/search.module \search_simplify()
- 4 modules/search.module \search_simplify()
- 5 modules/search/search.module \search_simplify()
- 6 modules/search/search.module \search_simplify()
- 7 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 - Enables site-wide keyword searching.
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);
}