--- 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);
}
--- 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('<highlight>', '</highlight>'), array('<span class="search-term">', '</span>'), $result['page_text']);
if ( !empty($result['page_text']) )
$result['page_text'] .= '<br />';
- $result['page_name'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="title-search-term">', '</span>'), $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('<highlight>', '</highlight>'), array('<span class="title-search-term">', '</span>'), $result['page_name']);
+ }
+
$result['url_highlight'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="url-search-term">', '</span>'), $result['url_highlight']);
if ( $result['page_length'] >= 1048576 )
{