1 node.module | _node_index_node(Node $node) |
Indexes a single node.
Parameters
Node $node: The node to index.
File
- core/
modules/ node/ node.module, line 2486 - The core module that allows content to be submitted to the site.
Code
function _node_index_node(Node $node) {
// Save the changed time of the most recent indexed node, for the search
// results half-life calculation.
state_set('node_cron_last', (int) $node->changed);
// Render the node.
$build = node_view($node, 'search_index');
unset($build['#theme']);
$node->rendered = backdrop_render($build);
$text = '<h1>' . check_plain($node->title) . '</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);
}