protected SearchQuery::parseWord($word)
Parses a word or phrase for parseQuery().
Splits a phrase into words. Adds its words to $this->words, if it is not already there. Returns a list containing the number of new words found, and the total number of words in the phrase.
File
- core/modules/search/src/SearchQuery.php, line 358
Class
- SearchQuery
- Search query extender and helper functions.
Namespace
Drupal\search
Code
protected function parseWord($word) { $num_new_scores = 0; $num_valid_words = 0; // Determine the scorewords of this word/phrase. $split = explode(' ', $word); foreach ($split as $s) { $num = is_numeric($s); if ($num || Unicode::strlen($s) >= \Drupal::config('search.settings')->get('index.minimum_word_size')) { if (!isset($this->words[$s])) { $this->words[$s] = $s; $num_new_scores++; } $num_valid_words++; } } // Return matching snippet and number of added words. return array($num_new_scores, $num_valid_words); }
Please login to continue.