aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-01-10 15:32:04 -0800
committerzotlabs <mike@macgirvin.com>2018-01-10 15:32:04 -0800
commitc09bab466a989a606fd1940a667eb95b90fabe09 (patch)
tree7b0e8d56568e9e34ed50fc7f77da27b429150e16
parentd0d72c7fd2a7c96840fa95b8a18d66eff1fb139e (diff)
downloadvolse-hubzilla-c09bab466a989a606fd1940a667eb95b90fabe09.tar.gz
volse-hubzilla-c09bab466a989a606fd1940a667eb95b90fabe09.tar.bz2
volse-hubzilla-c09bab466a989a606fd1940a667eb95b90fabe09.zip
hubzilla issue #945 continued: We previously blocked directory keywords when searching the local directory as it produced errant results and included results from the entire directory space (an issue that was resolved satisfactorily by that fix sometime in the past). As a result of issue #945 this was reworked so that we should return correct results for keywords when searching either the local directory or a standalone directory.
-rw-r--r--Zotlabs/Module/Dirsearch.php2
-rw-r--r--include/taxonomy.php19
2 files changed, 13 insertions, 8 deletions
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index e6cf5449a..53ec1a850 100644
--- a/Zotlabs/Module/Dirsearch.php
+++ b/Zotlabs/Module/Dirsearch.php
@@ -313,7 +313,7 @@ class Dirsearch extends \Zotlabs\Web\Controller {
$ret['results'] = $entries;
if($kw) {
- $k = dir_tagadelic($kw);
+ $k = dir_tagadelic($kw, $hub);
if($k) {
$ret['keywords'] = array();
foreach($k as $kv) {
diff --git a/include/taxonomy.php b/include/taxonomy.php
index a646df28c..278925391 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -309,19 +309,27 @@ function article_tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags
-function dir_tagadelic($count = 0) {
+function dir_tagadelic($count = 0, $hub = '') {
$count = intval($count);
$dirmode = get_config('system','directory_mode');
- if($dirmode == DIRECTORY_MODE_STANDALONE) {
+ if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) {
+ $hub = \App::get_hostname();
+ }
+
+ if($hub)
+ $hub_query = " and xtag_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
+ else
+ $hub_query = '';
+
+ if($hub_query) {
// Fetch tags
$r = q("select xtag_term as term, count(xtag_term) as total from xtag
left join hubloc on xtag_hash = hubloc_hash
- where xtag_flags = 0 and hubloc_url = '%s'
+ where xtag_flags = 0 $hub_query
group by xtag_term order by total desc %s",
- dbesc(z_root()),
((intval($count)) ? "limit $count" : '')
);
}
@@ -485,9 +493,6 @@ function dir_tagblock($link,$r) {
$o = '';
$observer = get_observer_hash();
- if(! get_directory_setting($observer, 'globaldir'))
- return $o;
-
if(! $r)
$r = App::$data['directory_keywords'];