protected function SearchQuery::parseWord

protected SearchQuery::parseWord($word)

Helper function for parseQuery().

File

modules/search/search.extender.inc, line 325
Search query extender and helper functions.

Class

SearchQuery
Do a query on the full-text search index for a word or words.

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 || drupal_strlen($s) >= variable_get('minimum_word_size', 3)) {
      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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!search!search.extender.inc/function/SearchQuery::parseWord/7.x