You are here

function node_reindex_node_search in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/node.module \node_reindex_node_search()

Marks a node to be re-indexed by the node_search plugin.

Parameters

int $nid: The node ID.

4 calls to node_reindex_node_search()
Node::postSave in core/modules/node/src/Entity/Node.php
Acts on a saved entity before the insert or update hook is invoked.
node_comment_delete in core/modules/node/node.module
Implements hook_ENTITY_TYPE_delete() for comment entities.
node_comment_insert in core/modules/node/node.module
Implements hook_ENTITY_TYPE_insert() for comment entities.
node_comment_update in core/modules/node/node.module
Implements hook_ENTITY_TYPE_update() for comment entities.

File

core/modules/node/node.module, line 1427
The core module that allows content to be submitted to the site.

Code

function node_reindex_node_search($nid) {
  if (\Drupal::moduleHandler()
    ->moduleExists('search')) {

    // Reindex node context indexed by the node module search plugin.
    \Drupal::service('search.index')
      ->markForReindex('node_search', $nid);
  }
}