From 7efcdfb7e2e3033fd3f1606313b62b2591a95e74 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 1 Oct 2007 13:05:26 +0000 Subject: [PATCH] * (bug 278) Search results no longer highlight incorrect partial word matches --- RELEASE-NOTES | 2 ++ includes/SearchMySQL4.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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" ); -- 2.20.1