aboutsummaryrefslogtreecommitdiffstats
path: root/mod/network.php
diff options
context:
space:
mode:
authorSimon <simon@kisikew.org>2012-05-29 13:13:10 -0700
committerSimon <simon@kisikew.org>2012-05-29 13:13:10 -0700
commit43c185ce04051caa0ae7543d635fa0b015befc58 (patch)
tree492e88d698971dd94d512172df7b71ed04e3048d /mod/network.php
parent39927e3dc5d0fc942ef9428b5c5c0d9b8cbb2f56 (diff)
parentc707cba4c8cd8855124b1991cfe8fd2c0c34c8ba (diff)
downloadvolse-hubzilla-43c185ce04051caa0ae7543d635fa0b015befc58.tar.gz
volse-hubzilla-43c185ce04051caa0ae7543d635fa0b015befc58.tar.bz2
volse-hubzilla-43c185ce04051caa0ae7543d635fa0b015befc58.zip
Merge pull request #316 from annando/master
Speed improvements
Diffstat (limited to 'mod/network.php')
-rw-r--r--mod/network.php38
1 files changed, 29 insertions, 9 deletions
diff --git a/mod/network.php b/mod/network.php
index fbfe2de4f..a94272a42 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -402,10 +402,22 @@ function network_content(&$a, $update = 0) {
if(x($_GET,'search')) {
$search = escape_tags($_GET['search']);
- $sql_extra .= sprintf(" AND ( `item`.`body` like '%s' OR `item`.`tag` like '%s' ) ",
- dbesc(protect_sprintf('%' . $search . '%')),
- dbesc(protect_sprintf('%]' . $search . '[%'))
- );
+ if (get_config('system','use_fulltext_engine')) {
+ if(strpos($search,'#') === 0)
+ $sql_extra .= sprintf(" AND (MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ",
+ dbesc(protect_sprintf($search))
+ );
+ else
+ $sql_extra .= sprintf(" AND (MATCH(`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode)) ",
+ dbesc(protect_sprintf($search)),
+ dbesc(protect_sprintf($search))
+ );
+ } else {
+ $sql_extra .= sprintf(" AND ( `item`.`body` like '%s' OR `item`.`tag` like '%s' ) ",
+ dbesc(protect_sprintf('%' . $search . '%')),
+ dbesc(protect_sprintf('%]' . $search . '[%'))
+ );
+ }
}
if(strlen($file)) {
$sql_extra .= file_tag_file_query('item',unxmlify($file));
@@ -416,11 +428,19 @@ function network_content(&$a, $update = 0) {
$myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace('www.','',$myurl);
$diasp_url = str_replace('/profile/','/u/',$myurl);
- $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 (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($update) {