We discussed this before, we need to come up with proper normalization for recency scoring - both for d6 and d7.

Comments

BlakeLucchesi’s picture

Status: Active » Needs review

Normalization for node recency has been solved with the following equation:

    'recent' => array(
      'title' => t('Recently posted'),
      'score' => 'POW(2.718, -5 * (1 - (GREATEST(n.created, n.changed) / %d)))',
      'arguments' => array(time()),
    ),

based on the following graph: http://en.wikipedia.org/wiki/Image:Plot-exponential-decay.png (details on exponential decay: http://en.wikipedia.org/wiki/Exponential_decay)

Explanation:

Based on the graph above we are using the function plotted by the green line. 2.718 is an approximation to the value e. In our normalization equation our value for X becomes: (1 - GREATEST(n.created, n.changed) / %d)), where %d is the current unix timestamp.

This ensures that nodes created/changed at the same instance the search is done provides for maximum score potential from the recency ranking factor. As time passes since the node was updated or changed the score provided by this ranking factor will decay exponentially at the rate shown by the green line.

*** note: we do (1 - normalized time) so that nodes published most recently are closer to 0 on the x axis in the plot and vice versa, all the way until x = 1.