_node_index_node
- Versions
- 6 – 7
_node_index_node($node)
Index a single node.
Parameters
$node The node to index.
Code
modules/node/node.module, line 2184
<?php
function _node_index_node($node) {
$node = node_load($node->nid);
// Save the changed time of the most recent indexed node, for the search
// results half-life calculation.
variable_set('node_cron_last', $node->changed);
// Render the node.
$build = node_build($node, 'search_index');
unset($build['#theme']);
$node->rendered = drupal_render($build);
$text = '<h1>' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
// Fetch extra data normally not visible
$extra = module_invoke_all('node_update_index', $node);
foreach ($extra as $t) {
$text .= $t;
}
// Update index
search_index($node->nid, 'node', $text);
}
?>Login or register to post comments 