summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--porterstemmer.module11
1 files changed, 7 insertions, 4 deletions
diff --git a/porterstemmer.module b/porterstemmer.module
index 5641e89..1c70543 100644
--- a/porterstemmer.module
+++ b/porterstemmer.module
@@ -13,10 +13,10 @@
*
* Stems the words in $text, using the Porter Stemmer 2 algorithm.
*/
-function porterstemmer_search_preprocess(&$text) {
+function porterstemmer_search_preprocess($text) {
// Convert text to lower case, and replace special apostrophes with regular
- // apostrophes
+ // apostrophes.
$text = drupal_strtolower(str_replace('’', "'", $text));
// Split into words
@@ -28,7 +28,7 @@ function porterstemmer_search_preprocess(&$text) {
$has_pecl_stem = _porterstemmer_pecl_loaded();
- // Process each word, skipping delimiters
+ // Process each word, skipping delimiters.
$isword = !preg_match('/' . PORTERSTEMMER_BOUNDARY . '/', $words[0] );
foreach ($words as $k => $word) {
if ($isword) {
@@ -42,7 +42,7 @@ function porterstemmer_search_preprocess(&$text) {
$isword = !$isword;
}
- // Put it all back together
+ // Put it all back together (note that delimiters are in $words).
return implode('', $words);
}
@@ -58,6 +58,9 @@ function porterstemmer_help($section = 'admin/help#search') {
/**
* Implementation of hook_sbp_excerpt_match().
+ *
+ * Allows Porter Stemmer to display better search excerpts with the
+ * Search by page module.
*/
function porterstemmer_sbp_excerpt_match( $key, $text, $offset, $boundary ) {
// Stem the keyword down to its root form.