_search_parse_query

Versions
4.7
_search_parse_query(&$word, &$scores, $not = false)
5 – 6
_search_parse_query(&$word, &$scores, $not = FALSE)

Helper function for search_parse_query();

Code

modules/search/search.module, line 750

<?php
function _search_parse_query(&$word, &$scores, $not = FALSE) {
  $count = 0;
  // Determine the scorewords of this word/phrase
  if (!$not) {
    $split = explode(' ', $word);
    foreach ($split as $s) {
      $num = is_numeric($s);
      if ($num || drupal_strlen($s) >= variable_get('minimum_word_size', 3)) {
        $s = $num ? ((int)ltrim($s, '-0')) : $s;
        if (!isset($scores[$s])) {
          $scores[$s] = $s;
          $count++;
        }
      }
    }
  }
  // Return matching snippet and number of added words
  return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%% %s %%'", $count);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.