aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.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 /include/api.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 'include/api.php')
-rw-r--r--include/api.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/api.php b/include/api.php
index f58a91a72..5697fbdbc 100644
--- a/include/api.php
+++ b/include/api.php
@@ -976,7 +976,7 @@
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
//$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
-
+
$start = $page*$count;
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
@@ -985,11 +985,19 @@
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl);
- $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` regexp '%s' or `tag` regexp '%s' or tag regexp '%s' )) ",
- dbesc($myurl . '$'),
- dbesc($myurl . '\\]'),
- dbesc($diasp_url . '\\]')
- );
+
+ if (get_config('system','use_fulltext_engine'))
+ $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where (MATCH(`author-link`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(`tag`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode))) ",
+ dbesc(protect_sprintf($myurl)),
+ dbesc(protect_sprintf($myurl)),
+ dbesc(protect_sprintf($diasp_url))
+ );
+ else
+ $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ",
+ dbesc(protect_sprintf('%' . $myurl)),
+ dbesc(protect_sprintf('%' . $myurl . '\\]%')),
+ dbesc(protect_sprintf('%' . $diasp_url . '\\]%'))
+ );
if ($max_id > 0)
$sql_extra .= ' AND `item`.`id` <= '.intval($max_id);