function node_reindex_node_search

Same name in other branches
  1. 9 core/modules/node/node.module \node_reindex_node_search()
  2. 8.9.x core/modules/node/node.module \node_reindex_node_search()
  3. 10 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
NodeHooks1::commentDelete in core/modules/node/src/Hook/NodeHooks1.php
Implements hook_ENTITY_TYPE_delete() for comment entities.
NodeHooks1::commentInsert in core/modules/node/src/Hook/NodeHooks1.php
Implements hook_ENTITY_TYPE_insert() for comment entities.
NodeHooks1::commentUpdate in core/modules/node/src/Hook/NodeHooks1.php
Implements hook_ENTITY_TYPE_update() for comment entities.

File

core/modules/node/node.module, line 671

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.