]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/personaltagcloudsection.php
send_message -> sendMessage
[quix0rs-gnu-social.git] / lib / personaltagcloudsection.php
index 0b29d58ca60386b9331de6ad7a330cab9191ca14..5ea3f188dbf61b2385ad85fde65d15831a381154 100644 (file)
@@ -58,13 +58,10 @@ class PersonalTagCloudSection extends TagCloudSection
 
     function getTags()
     {
-        if (common_config('db', 'type') == 'pgsql') {
-            $weightexpr='sum(exp(-extract(epoch from (now() - notice_tag.created)) / %s))';
-        } else {
-            $weightexpr='sum(exp(-(now() - notice_tag.created) / %s))';
-        }
-       $qry = 'SELECT notice_tag.tag, '.
+        $weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
+        // @fixme should we use the cutoff too? Doesn't help with indexing per-user.
+
+        $qry = 'SELECT notice_tag.tag, '.
           $weightexpr . ' as weight ' .
           'FROM notice_tag JOIN notice ' .
           'ON notice_tag.notice_id = notice.id ' .
@@ -83,7 +80,6 @@ class PersonalTagCloudSection extends TagCloudSection
 
         $tag = Memcached_DataObject::cachedQuery('Notice_tag',
                                                  sprintf($qry,
-                                                         common_config('tag', 'dropoff'),
                                                          $this->user->id),
                                                  3600);
         return $tag;