diff options
author | Michael Vogel <icarus@dabo.de> | 2012-05-26 11:51:48 +0200 |
---|---|---|
committer | Michael Vogel <icarus@dabo.de> | 2012-05-26 11:51:48 +0200 |
commit | a5dc41ab131d4235eb947ff00d7af0593bf0e460 (patch) | |
tree | 2040cae6f8582dc1112b5d475750c179fde014dc /mod/network.php | |
parent | a612b10b2a1c2d1afbca1fd2f38ebc35110081dc (diff) | |
download | volse-hubzilla-a5dc41ab131d4235eb947ff00d7af0593bf0e460.tar.gz volse-hubzilla-a5dc41ab131d4235eb947ff00d7af0593bf0e460.tar.bz2 volse-hubzilla-a5dc41ab131d4235eb947ff00d7af0593bf0e460.zip |
Saved searches now can search for tags as well
Diffstat (limited to 'mod/network.php')
-rw-r--r-- | mod/network.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/mod/network.php b/mod/network.php index f54d055d3..6b4fa9a5b 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)); |