* @param integer $uid
* @param integer $start
* @param integer $limit
+ * @param integer $last_uriid
* @return array with URI-ID
*/
- public static function getURIIdListByTag(string $search, int $uid = 0, int $start = 0, int $limit = 100)
+ public static function getURIIdListByTag(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0)
{
$condition = ["`name` = ? AND (NOT `private` OR (`private` AND `uid` = ?))", $search, $uid];
+
+ if (!empty($last_uriid)) {
+ $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $last_uriid]);
+ }
+
$params = [
'order' => ['uri-id' => true],
'group_by' => ['uri-id'],
{
$tagsStmt = DBA::p("SELECT `name` AS `term`, COUNT(*) AS `score`
FROM `tag-search-view`
- WHERE `private` = ? AND `received` > DATE_SUB(NOW(), INTERVAL ? HOUR)
+ WHERE `private` = ? AND `uid` = ? AND `received` > DATE_SUB(NOW(), INTERVAL ? HOUR)
GROUP BY `term` ORDER BY `score` DESC LIMIT ?",
- Item::PUBLIC, $period, $limit);
+ Item::PUBLIC, 0, $period, $limit);
if (DBA::isResult($tagsStmt)) {
$tags = DBA::toArray($tagsStmt);
- DI::cache()->set('global_trending_tags-' . $period . '-' . $limit, $tags, Duration::HOUR);
+ DI::cache()->set('global_trending_tags-' . $period . '-' . $limit, $tags, Duration::DAY);
return $tags;
}
*/
public static function getLocalTrendingHashtags(int $period, $limit = 10)
{
- $tags = DI::cache()->get('local_trending_tags');
+ $tags = DI::cache()->get('local_trending_tags-' . $period . '-' . $limit);
if (!empty($tags)) {
return $tags;
} else {
if (DBA::isResult($tagsStmt)) {
$tags = DBA::toArray($tagsStmt);
- DI::cache()->set('local_trending_tags', $tags, Duration::HOUR);
+ DI::cache()->set('local_trending_tags-' . $period . '-' . $limit, $tags, Duration::DAY);
return $tags;
}