From: Brian Wolff Date: Tue, 6 Sep 2016 19:42:12 +0000 (+0000) Subject: Clarify that $terms get preg_quoted by caller in SearchHighlighter X-Git-Tag: 1.31.0-rc.0~5731^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20%20%20%24self2%20.%20%20%20%22&var_mode_affiche=boucle?a=commitdiff_plain;h=6941283af44ce27e848cd08058e30a6b51afe33b;p=lhc%2Fweb%2Fwiklou.git Clarify that $terms get preg_quoted by caller in SearchHighlighter Also fix misleading comment about which highlighter implementation is default. Change-Id: Ifb4d7fa79ec6325bdb0667fc10b6a1547b32ef69 --- diff --git a/includes/search/SearchHighlighter.php b/includes/search/SearchHighlighter.php index 2bd19558a2..dd41a6e1e4 100644 --- a/includes/search/SearchHighlighter.php +++ b/includes/search/SearchHighlighter.php @@ -34,10 +34,11 @@ class SearchHighlighter { } /** - * Default implementation of wikitext highlighting + * Wikitext highlighting when $wgAdvancedSearchHighlighting = true * * @param string $text - * @param array $terms Terms to highlight (unescaped) + * @param array $terms Terms to highlight (not html escaped but + * regex escaped via SearchDatabase::regexTerm()) * @param int $contextlines * @param int $contextchars * @return string @@ -145,7 +146,6 @@ class SearchHighlighter { } $anyterm = implode( '|', $terms ); $phrase = implode( "$wgSearchHighlightBoundaries+", $terms ); - // @todo FIXME: A hack to scale contextchars, a correct solution // would be to have contextchars actually be char and not byte // length, and do proper utf-8 substrings and lengths everywhere, @@ -485,8 +485,10 @@ class SearchHighlighter { * Simple & fast snippet extraction, but gives completely unrelevant * snippets * + * Used when $wgAdvancedSearchHighlighting is false. + * * @param string $text - * @param array $terms + * @param array $terms Escaped for regex by SearchDatabase::regexTerm() * @param int $contextlines * @param int $contextchars * @return string