diff options
author | Simon <simon@kisikew.org> | 2012-05-29 13:13:10 -0700 |
---|---|---|
committer | Simon <simon@kisikew.org> | 2012-05-29 13:13:10 -0700 |
commit | 43c185ce04051caa0ae7543d635fa0b015befc58 (patch) | |
tree | 492e88d698971dd94d512172df7b71ed04e3048d /mod/search.php | |
parent | 39927e3dc5d0fc942ef9428b5c5c0d9b8cbb2f56 (diff) | |
parent | c707cba4c8cd8855124b1991cfe8fd2c0c34c8ba (diff) | |
download | volse-hubzilla-43c185ce04051caa0ae7543d635fa0b015befc58.tar.gz volse-hubzilla-43c185ce04051caa0ae7543d635fa0b015befc58.tar.bz2 volse-hubzilla-43c185ce04051caa0ae7543d635fa0b015befc58.zip |
Merge pull request #316 from annando/master
Speed improvements
Diffstat (limited to 'mod/search.php')
-rw-r--r-- | mod/search.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/mod/search.php b/mod/search.php index 3e6bf68aa..d4cd9d967 100644 --- a/mod/search.php +++ b/mod/search.php @@ -71,7 +71,7 @@ function search_content(&$a) { notice( t('Public access denied.') . EOL); return; } - + nav_set_selected('search'); require_once("include/bbcode.php"); @@ -96,7 +96,6 @@ function search_content(&$a) { $o .= search($search,'search-box','/search',((local_user()) ? true : false)); - if(strpos($search,'#') === 0) { $tag = true; $search = substr($search,1); @@ -109,11 +108,17 @@ function search_content(&$a) { if(! $search) return $o; - if($tag) - $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ", dbesc('\\]' . preg_quote($search) . '\\[')); - else - $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(preg_quote($search))); - + if (get_config('system','use_fulltext_engine')) { + if($tag) + $sql_extra = sprintf(" AND MATCH (`item`.`tag`) AGAINST ('".'"%s"'."' in boolean mode) ", '#'.preg_quote($search)); + else + $sql_extra = sprintf(" AND MATCH (`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) ", dbesc(preg_quote($search))); + } else { + if($tag) + $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ", dbesc('\\]' . preg_quote($search) . '\\[')); + else + $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(preg_quote($search))); + } |