From: Brion Vibber Date: Mon, 1 Oct 2007 13:05:26 +0000 (+0000) Subject: * (bug 278) Search results no longer highlight incorrect partial word matches X-Git-Tag: 1.31.0-rc.0~51239 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=7efcdfb7e2e3033fd3f1606313b62b2591a95e74;p=lhc%2Fweb%2Fwiklou.git * (bug 278) Search results no longer highlight incorrect partial word matches --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cc7f6d6d00..98bae4faf4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -79,6 +79,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 11462) Fix typo in LanguageGetSpecialPageAliases hook name * (bug 11474) Fix unintentional fall-through in math error handling * (bug 11478) Fix undefined method call in file deletion interface +* (bug 278) Search results no longer highlight incorrect partial word matches + === API changes in 1.12 === diff --git a/includes/SearchMySQL4.php b/includes/SearchMySQL4.php index 2cd3a54fc3..271dbe1da3 100644 --- a/includes/SearchMySQL4.php +++ b/includes/SearchMySQL4.php @@ -54,7 +54,7 @@ class SearchMySQL4 extends SearchMySQL { // Match the quoted term in result highlighting... $regexp = preg_quote( str_replace( '"', '', $terms[2] ), '/' ); } - $this->searchTerms[] = $regexp; + $this->searchTerms[] = "\b$regexp\b"; } wfDebug( "Would search with '$searchon'\n" ); wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );