Same name and namespace in other branches
  1. 7.x modules/node/node.module \_node_index_node()

Index a single node.

Parameters

$node: The node to index.

1 call to _node_index_node()
node_update_index in modules/node/node.module
Implementation of hook_update_index().

File

modules/node/node.module, line 1836
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_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);

  // Build the node body.
  $node->build_mode = NODE_BUILD_SEARCH_INDEX;
  $node = node_build_content($node, FALSE, FALSE);
  $node->body = drupal_render($node->content);
  $text = '<h1>' . check_plain($node->title) . '</h1>' . $node->body;

  // Fetch extra data normally not visible
  $extra = node_invoke_nodeapi($node, 'update index');
  foreach ($extra as $t) {
    $text .= $t;
  }

  // Update index
  search_index($node->nid, 'node', $text);
}