2 * Implements hook_ranking().
4 function {{ machine_name }}_ranking() {
5 // If voting is disabled, we can avoid returning the array, no hard feelings.
6 if (variable_get('vote_node_enabled', TRUE)) {
8 'vote_average' => array(
9 'title' => t('Average vote'),
10 // Note that we use i.sid, the search index's search item id, rather than
14 'table' => 'vote_node_data',
15 'alias' => 'vote_node_data',
16 'on' => 'vote_node_data.nid = i.sid',
18 // The highest possible score should be 1, and the lowest possible score,
19 // always 0, should be 0.
20 'score' => 'vote_node_data.average / CAST(%f AS DECIMAL)',
21 // Pass in the highest possible voting score as a decimal argument.
22 'arguments' => array(variable_get('vote_score_max', 5)),