function file_entity_file_ranking in File Entity (fieldable files) 7.2
Same name and namespace in other branches
- 7.3 file_entity.module \file_entity_file_ranking()
Implements hook_file_ranking().
File
- ./
file_entity.module, line 650 - Extends Drupal file entities to be fieldable and viewable.
Code
function file_entity_file_ranking() {
// Create the ranking array and add the basic ranking options.
$ranking = array(
'relevance' => array(
'title' => t('Keyword relevance'),
// Average relevance values hover around 0.15
'score' => 'i.relevance',
),
);
// Add relevance based on creation date.
if ($file_cron_last = variable_get('file_entity_cron_last', 0)) {
$ranking['timestamp'] = array(
'title' => t('Recently posted'),
// Exponential decay with half-life of 6 months, starting at last indexed file
'score' => 'POW(2.0, (fm.timestamp - :file_cron_last) * 6.43e-8)',
'arguments' => array(
':file_cron_last' => $file_cron_last,
),
);
}
return $ranking;
}