function search_index_split in Drupal 8
Same name and namespace in other branches
- 4 modules/search.module \search_index_split()
- 5 modules/search/search.module \search_index_split()
- 6 modules/search/search.module \search_index_split()
- 7 modules/search/search.module \search_index_split()
- 9 core/modules/search/search.module \search_index_split()
Simplifies and splits a string 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.
See also
1 call to search_index_split()
- SearchIndex::index in core/
modules/ search/ src/ SearchIndex.php - Updates the full-text search index for a particular item.
File
- core/
modules/ search/ search.module, line 329 - Enables site-wide keyword searching.
Code
function search_index_split($text, $langcode = NULL) {
$last =& drupal_static(__FUNCTION__);
$lastsplit =& drupal_static(__FUNCTION__ . ':lastsplit');
if ($last == $text) {
return $lastsplit;
}
// Process words
$text = search_simplify($text, $langcode);
$words = explode(' ', $text);
// Save last keyword result
$last = $text;
$lastsplit = $words;
return $words;
}