aboutsummaryrefslogtreecommitdiffstats
path: root/mod/search.php
diff options
context:
space:
mode:
authorMichael Vogel <icarus@dabo.de>2012-05-26 03:21:07 +0200
committerMichael Vogel <icarus@dabo.de>2012-05-26 03:21:07 +0200
commit49512105082dde72553f4250e6284920612cc6b8 (patch)
treee6222e7ca809b116af44d006218271bc36b5c009 /mod/search.php
parenta71e3134bf7250b60cafd1e51098eea70c3459de (diff)
downloadvolse-hubzilla-49512105082dde72553f4250e6284920612cc6b8.tar.gz
volse-hubzilla-49512105082dde72553f4250e6284920612cc6b8.tar.bz2
volse-hubzilla-49512105082dde72553f4250e6284920612cc6b8.zip
Speed optimisation by enabling the posibility of the MySQL fulltext engine
Diffstat (limited to 'mod/search.php')
-rw-r--r--mod/search.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/mod/search.php b/mod/search.php
index 3e6bf68aa..ac5134696 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -109,11 +109,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)));
+ }