diff options
author | Michael <icarus@dabo.de> | 2012-05-26 12:06:19 +0200 |
---|---|---|
committer | Michael <icarus@dabo.de> | 2012-05-26 12:06:19 +0200 |
commit | 817fc37f41c030381507384db581f62d9a1b5044 (patch) | |
tree | c152def3537eb41e933e8ad537085af6abeb91cd /mod/search.php | |
parent | 7b3c02057db47a627b56bdd79f1055ea7f876617 (diff) | |
parent | a5dc41ab131d4235eb947ff00d7af0593bf0e460 (diff) | |
download | volse-hubzilla-817fc37f41c030381507384db581f62d9a1b5044.tar.gz volse-hubzilla-817fc37f41c030381507384db581f62d9a1b5044.tar.bz2 volse-hubzilla-817fc37f41c030381507384db581f62d9a1b5044.zip |
Merge branch 'master' of github.com:annando/friendica
Conflicts:
mod/network.php
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))); + } |