mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Improve search performance - fixes #130
This commit is contained in:
parent
50140cbf18
commit
5d9e464ce5
1 changed files with 4 additions and 0 deletions
|
@ -627,6 +627,8 @@ class search
|
|||
// Loop over each nterm and find it in the source
|
||||
foreach($nterms as $nterm)
|
||||
{
|
||||
if(in_array($nterm, static::$stop_words))
|
||||
continue;
|
||||
$all_offsets = mb_stripos_all($source, $nterm);
|
||||
// Skip over adding matches if there aren't any
|
||||
if($all_offsets === false)
|
||||
|
@ -706,6 +708,8 @@ class search
|
|||
|
||||
foreach($qterms as $qterm)
|
||||
{
|
||||
if(in_array($qterm, static::$stop_words))
|
||||
continue;
|
||||
// From http://stackoverflow.com/a/2483859/1460422
|
||||
$context = preg_replace("/" . str_replace("/", "\/", preg_quote($qterm)) . "/i", "<strong class='search-term-highlight'>$0</strong>", $context);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue