function _node_rankings
7.x node.module | _node_rankings(SelectQueryExtender $query) |
Gathers the rankings from the the hook_ranking() implementations.
Parameters
$query: A query object that has been extended with the Search DB Extender.
2 calls to _node_rankings()
- hook_search_execute in drupal-7.x/
modules/ search/ search.api.php - Execute a search for a set of key words.
- node_search_execute in drupal-7.x/
modules/ node/ node.module - Implements hook_search_execute().
File
- drupal-7.x/
modules/ node/ node.module, line 1623 - The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.
Code
function _node_rankings(SelectQueryExtender $query) {
if ($ranking = module_invoke_all('ranking')) {
$tables = &$query->getTables();
foreach ($ranking as $rank => $values) {
if ($node_rank = variable_get('node_rank_' . $rank, 0)) {
// If the table defined in the ranking isn't already joined, then add it.
if (isset($values['join']) && !isset($tables[$values['join']['alias']])) {
$query->addJoin($values['join']['type'], $values['join']['table'], $values['join']['alias'], $values['join']['on']);
}
$arguments = isset($values['arguments']) ? $values['arguments'] : array();
$query->addScore($values['score'], $arguments, $node_rank);
}
}
}
}