aboutsummaryrefslogtreecommitdiffstats
path: root/mod/search.php
diff options
context:
space:
mode:
authorzottel <github@zottel.net>2012-05-30 11:08:02 +0200
committerzottel <github@zottel.net>2012-05-30 11:08:02 +0200
commit24b58af68938558baa2ddc6809401ec528ff1176 (patch)
tree4347cab04767aafe7b5567d68539e666284fa3cc /mod/search.php
parent36d6018c110fca190b720c5ff27883c2d4ed70c3 (diff)
parent88a0d6a1d53a93fa0d43591f85b72a8a72c13d53 (diff)
downloadvolse-hubzilla-24b58af68938558baa2ddc6809401ec528ff1176.tar.gz
volse-hubzilla-24b58af68938558baa2ddc6809401ec528ff1176.tar.bz2
volse-hubzilla-24b58af68938558baa2ddc6809401ec528ff1176.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'mod/search.php')
-rw-r--r--mod/search.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/mod/search.php b/mod/search.php
index 3e6bf68aa..466ffc4c3 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,10 +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) ", '#'.dbesc(protect_sprintf($search)));
+ else
+ $sql_extra = sprintf(" AND MATCH (`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) ", dbesc(protect_sprintf($search)));
+ } else {
+ if($tag)
+ $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ", dbesc('\\]' . protect_sprintf(preg_quote($search)) . '\\['));
+ else
+ $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+ }