aboutsummaryrefslogtreecommitdiffstats
path: root/mod/search.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-29 16:50:42 -0700
committerfriendica <info@friendica.com>2012-05-29 16:50:42 -0700
commit21d79e787ef6a1fd183a4f439c2488110841b530 (patch)
tree37af0898bb3ef5f39384d98aeae409a476b41aed /mod/search.php
parent419cf91aae555f6e42767765f476b1f1cc85e5df (diff)
parent43c185ce04051caa0ae7543d635fa0b015befc58 (diff)
downloadvolse-hubzilla-21d79e787ef6a1fd183a4f439c2488110841b530.tar.gz
volse-hubzilla-21d79e787ef6a1fd183a4f439c2488110841b530.tar.bz2
volse-hubzilla-21d79e787ef6a1fd183a4f439c2488110841b530.zip
Merge https://github.com/friendica/friendica into pull
Conflicts: mod/search.php
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 6d4bd07e3..20007ada7 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('\\]' . protect_sprintf(preg_quote($search)) . '\\['));
- else
- $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+ if (get_config('system','use_fulltext_engine')) {
+ if($tag)
+ $sql_extra = sprintf(" AND MATCH (`item`.`tag`) AGAINST ('".'"%s"'."' in boolean mode) ", '#'.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))));
+ }