From 6941283af44ce27e848cd08058e30a6b51afe33b Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Tue, 6 Sep 2016 19:42:12 +0000 Subject: [PATCH] Clarify that $terms get preg_quoted by caller in SearchHighlighter Also fix misleading comment about which highlighter implementation is default. Change-Id: Ifb4d7fa79ec6325bdb0667fc10b6a1547b32ef69 --- includes/search/SearchHighlighter.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 -- 2.20.1