X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsearch.php;h=320ffddcef2fbc0df671e6c58e5c26937372711a;hb=15cae001d947d27a75147aecec089e44d7b8c31f;hp=635c87b705cb0084c0fb9aca834e69ca13e0c3a5;hpb=513ef2410d9b892c8ebcb7ceac96b97023c3b5a5;p=friendica.git
diff --git a/mod/search.php b/mod/search.php
index 635c87b705..320ffddcef 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");
@@ -80,7 +80,7 @@ function search_content(&$a) {
$o = '
' . "\r\n";
- $o .= '' . t('Search This Site') . '
';
+ $o .= '' . t('Search') . '
';
if(x($a->data,'search'))
$search = notags(trim($a->data['search']));
@@ -96,19 +96,29 @@ function search_content(&$a) {
$o .= search($search,'search-box','/search',((local_user()) ? true : false));
-
if(strpos($search,'#') === 0) {
$tag = true;
$search = substr($search,1);
}
+ if(strpos($search,'@') === 0) {
+ require_once('mod/dirfind.php');
+ return dirfind_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) ", '#'.dbesc(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))));
+ }
@@ -136,7 +146,7 @@ function search_content(&$a) {
}
$r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`,
- `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
+ `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
`user`.`nickname`