Skip to content

Commit

Permalink
fix fulltext search highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
skywalker512 committed Jun 17, 2018
1 parent 9ff41da commit 0698bb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/lib/functions.render.php
Expand Up @@ -32,7 +32,7 @@ function highlight($text, $words)
if (!($word = trim($word))) continue;

// Make sure we only highlight whole words that would've been matched by a fulltext search.
$text = preg_replace("/(?<=[\s>]|^)(".preg_quote($word, "/").")(?=[\s<,\.?!:\/-]|$)/iu", "<span class='highlight'>$1</span>", $text);
$text = preg_replace("/(".preg_quote($word, "/").")/iu", "<span class='highlight'>$1</span>", $text);

}
return $text;
Expand Down

0 comments on commit 0698bb0

Please sign in to comment.