From 5d9e464ce5993264e25b5ff1ffedeaf538e98f54 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Thu, 26 Jan 2017 20:55:46 +0000 Subject: [PATCH] Improve search performance - fixes #130 --- modules/feature-search.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/feature-search.php b/modules/feature-search.php index 5054dd1..ca7802b 100755 --- a/modules/feature-search.php +++ b/modules/feature-search.php @@ -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", "$0", $context); }