# HG changeset patch # User Dan Fuhry # Date 1353342917 18000 # Node ID c660cf54c04523d34bfb7e4e67c38592ff1c107a # Parent 23f89f989922b636e4dda8cfbc3f76a5ac4d586c Fixed a few bugs/display issues in search diff -r 23f89f989922 -r c660cf54c045 includes/search.php --- a/includes/search.php Mon Nov 19 11:33:49 2012 -0500 +++ b/includes/search.php Mon Nov 19 11:35:17 2012 -0500 @@ -276,7 +276,7 @@ if ( strstr($word_cs, $qword) ) $lev_array[ $qword ] = levenshtein($qword, $word_cs); } - if ( min($lev_array) > 3 ) + if ( count($lev_array) && min($lev_array) > 3 ) { $inc /= array_sum($lev_array) / count($lev_array); } diff -r 23f89f989922 -r c660cf54c045 plugins/SpecialSearch.php --- a/plugins/SpecialSearch.php Mon Nov 19 11:33:49 2012 -0500 +++ b/plugins/SpecialSearch.php Mon Nov 19 11:35:17 2012 -0500 @@ -137,7 +137,18 @@ $result['page_text'] = str_replace(array('', ''), array('', ''), $result['page_text']); if ( !empty($result['page_text']) ) $result['page_text'] .= '
'; - $result['page_name'] = str_replace(array('', ''), array('', ''), $result['page_name']); + + // localize the title... if it comes back from the language code, replace the title, losing highlighting. + // otherwise, keep the highlighted title from the search backend + if ( ($l10n_title = $lang->get(strip_tags($result['page_name']))) !== strip_tags($result['page_name']) ) + { + $result['page_name'] = $l10n_title; + } + else + { + $result['page_name'] = str_replace(array('', ''), array('', ''), $result['page_name']); + } + $result['url_highlight'] = str_replace(array('', ''), array('', ''), $result['url_highlight']); if ( $result['page_length'] >= 1048576 ) {