8.5.x node.api.php hook_node_update_index(\Drupal\node\NodeInterface $node)
8.0.x node.api.php hook_node_update_index(\Drupal\node\NodeInterface $node)
8.1.x node.api.php hook_node_update_index(\Drupal\node\NodeInterface $node)
8.2.x node.api.php hook_node_update_index(\Drupal\node\NodeInterface $node)
8.3.x node.api.php hook_node_update_index(\Drupal\node\NodeInterface $node)
8.4.x node.api.php hook_node_update_index(\Drupal\node\NodeInterface $node)
8.6.x node.api.php hook_node_update_index(\Drupal\node\NodeInterface $node)
7.x node.api.php hook_node_update_index($node)

Act on a node being indexed for searching.

This hook is invoked during search indexing, after loading, and after the result of rendering is added as $node->rendered to the node object.

Parameters

\Drupal\node\NodeInterface $node: The node being indexed.

Return value

string Additional node information to be indexed.

Related topics

1 function implements hook_node_update_index()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

comment_node_update_index in core/modules/comment/comment.module
Implements hook_node_update_index().

File

core/modules/node/node.api.php, line 395
Hooks specific to the Node module.

Code

function hook_node_update_index(\Drupal\node\NodeInterface $node) {
  $text = '';
  $ratings = db_query('SELECT title, description FROM {my_ratings} WHERE nid = :nid', array(
    ':nid' => $node
      ->id(),
  ));
  foreach ($ratings as $rating) {
    $text .= '<h2>' . Html::escape($rating->title) . '</h2>' . Xss::filter($rating->description);
  }
  return $text;
}