]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make tag dropoff configurable
authorEvan Prodromou <evan@prodromou.name>
Mon, 11 Aug 2008 17:58:20 +0000 (13:58 -0400)
committerEvan Prodromou <evan@prodromou.name>
Mon, 11 Aug 2008 17:58:20 +0000 (13:58 -0400)
darcs-hash:20080811175820-84dde-f3d934495fa90fadde5f7d5d0c37c5f2a575a9d8.gz

actions/tag.php
config.php.sample
lib/common.php

index 3f379ffdf2a6374d00f631698af37a14192b2fe6..1042513d5a1a42faee8b5ddf5e54736e3e583e6e 100644 (file)
@@ -21,7 +21,6 @@ if (!defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/actions/showstream.php');
 define('TAGS_PER_PAGE', 100);
-define('AGE_FACTOR', 864000.0);
 
 class TagAction extends StreamAction {
 
@@ -90,7 +89,7 @@ class TagAction extends StreamAction {
                # This should probably be cached rather than recalculated
                $tags = DB_DataObject::factory('Notice_tag');
                $tags->selectAdd('max(notice_id) as last_notice_id');
-               $tags->selectAdd(sprintf('sum(exp(-(now() - created)/%f)) as weight', AGE_FACTOR));
+               $tags->selectAdd(sprintf('sum(exp(-(now() - created)/%f)) as weight', common_config('tag', 'dropoff')));
                $tags->groupBy('tag');
                $tags->orderBy('weight DESC');
 
index 5327198bf0ade388f11082152d20affbe9f7e060..8ee1f4fb46c6ab9b22133c7cea973bff050a9698 100644 (file)
@@ -71,4 +71,8 @@ $config['db']['database'] = 'mysql://laconica:microblog@localhost/laconica';
 #Do notice broadcasts offline
 #If you set this, you must run the xmppdaemon.php
 #as a daemon (with, say, start-stop-daemon)
-#$config['queue']['enabled'] = true;
\ No newline at end of file
+#$config['queue']['enabled'] = true;
+
+#exponential decay factor for tags, default 10 days
+#raise this if traffic is slow, lower it if it's fast
+#$config['tag']['dropoff'] = 86400.0 * 10;
\ No newline at end of file
index a59e6106b2199ef1a79de369f6b74dd702b28dfe..9269ace89dbb1c6bbb0680cea5d5f969d2895d6f 100644 (file)
@@ -85,6 +85,8 @@ $config =
                          'host' => NULL, # only set if != server
                          'debug' => false, # print extra debug info
                          'public' => array()), # JIDs of users who want to receive the public stream
+               'tag' =>
+               array('dropoff' => 864000.0),
                );
 
 $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');