]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Tag.php
Merge pull request #10093 from urbalazs/copyright-2021
[friendica.git] / src / Model / Tag.php
index c7155b5393a13586a2b8fd6fe1fbc22550d3e6be..796cc13f8872a6653b0c925252862b7e43b6e683 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -547,10 +547,10 @@ class Tag
        {
                $block_sql = self::getBlockedSQL();
 
-               $tagsStmt = DBA::p("SELECT `name` AS `term`, COUNT(*) AS `score`
+               $tagsStmt = DBA::p("SELECT `name` AS `term`, COUNT(*) AS `score`, COUNT(DISTINCT(`author-id`)) as `authors`
                        FROM `tag-search-view`
                        WHERE `private` = ? AND `uid` = ? AND `received` > DATE_SUB(NOW(), INTERVAL ? HOUR) $block_sql
-                       GROUP BY `term` ORDER BY `score` DESC LIMIT ?",
+                       GROUP BY `term` ORDER BY `authors` DESC, `score` DESC LIMIT ?",
                        Item::PUBLIC, 0, $period, $limit);
 
                if (DBA::isResult($tagsStmt)) {
@@ -592,10 +592,10 @@ class Tag
        {
                $block_sql = self::getBlockedSQL();
 
-               $tagsStmt = DBA::p("SELECT `name` AS `term`, COUNT(*) AS `score`
+               $tagsStmt = DBA::p("SELECT `name` AS `term`, COUNT(*) AS `score`, COUNT(DISTINCT(`author-id`)) as `authors`
                        FROM `tag-search-view`
                        WHERE `private` = ? AND `wall` AND `origin` AND `received` > DATE_SUB(NOW(), INTERVAL ? HOUR) $block_sql
-                       GROUP BY `term` ORDER BY `score` DESC LIMIT ?",
+                       GROUP BY `term` ORDER BY `authors` DESC, `score` DESC LIMIT ?",
                        Item::PUBLIC, $period, $limit);
 
                if (DBA::isResult($tagsStmt)) {