Index: search.module =================================================================== --- search.module (revision 561) +++ search.module (working copy) @@ -828,7 +828,8 @@ $query = implode(' AND ', $query); // Build word-index conditions for the first pass - $query2 = substr(str_repeat("i.word = '%s' OR ", count($arguments2)), 0, -4); + //$query2 = substr(str_repeat("i.word = '%s' OR ", count($arguments2)), 0, -4); + $query2 = substr(str_repeat("i.word like '%%%s%%' OR ", count($arguments2)), 0, -4); return array($query, $arguments, $query2, $arguments2, $matches, $simple, $warning); } @@ -855,7 +856,8 @@ } } // Return matching snippet and number of added words - return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%% %s %%'", $num_new_scores, $num_valid_words); + //return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%% %s %%'", $num_new_scores, $num_valid_words); + return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%%%s%%'", $num_new_scores, $num_valid_words); } /** @@ -1171,7 +1173,9 @@ */ function search_excerpt($keys, $text) { // We highlight around non-indexable or CJK characters. - $boundary = '(?:(?<=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .'])|(?=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .']))'; + //$boundary = '(?:(?<=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .'])|(?=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .']))'; + // To highlight partial words we use no boundary. + $boundary = ''; // Extract positive keywords and phrases preg_match_all('/ ("([^"]+)"|(?!OR)([^" ]+))/', ' '. $keys, $matches);