function porterstemmer_search_preprocess in Porter-Stemmer 5
Same name and namespace in other branches
- 8 porterstemmer.module \porterstemmer_search_preprocess()
- 6.2 porterstemmer.module \porterstemmer_search_preprocess()
- 6 porterstemmer.module \porterstemmer_search_preprocess()
- 7 porterstemmer.module \porterstemmer_search_preprocess()
Implementation of hook_search_preprocess
File
- ./
porterstemmer.module, line 13
Code
function porterstemmer_search_preprocess(&$text) {
// Split words from noise and remove apostrophes
$words = preg_split('/([^a-zA-Z]+)/', str_replace("'", '', $text), -1, PREG_SPLIT_DELIM_CAPTURE);
// Process each word
$odd = true;
foreach ($words as $k => $word) {
if ($odd) {
$words[$k] = Stem($word);
}
$odd = !$odd;
}
// Put it all back together
return implode('', $words);
}