function _top_searches_valid_phrase in Top Searches 7
Same name and namespace in other branches
- 6 top_searches.module \_top_searches_valid_phrase()
Verify the keys contain at least one valid word
Return value
True on valid phrase, FALSE on non-valid
1 call to _top_searches_valid_phrase()
File
- ./
top_searches.module, line 108
Code
function _top_searches_valid_phrase($keys) {
// Check for minimum search word size, according to the site wide search configuration:
$min = variable_get('minimum_word_size', 3);
$words = explode(' ', $keys);
$pass = FALSE;
foreach ($words as $word) {
_search_index_truncate($word);
// We need at least one word with minimal length, for the whole search phrase to be valid.
if (drupal_strlen($word) >= $min) {
$pass = TRUE;
break;
}
}
return $pass;
}