function NodeSearch::indexStatus

Same name in other branches
  1. 9 core/modules/node/src/Plugin/Search/NodeSearch.php \Drupal\node\Plugin\Search\NodeSearch::indexStatus()
  2. 10 core/modules/node/src/Plugin/Search/NodeSearch.php \Drupal\node\Plugin\Search\NodeSearch::indexStatus()
  3. 11.x core/modules/node/src/Plugin/Search/NodeSearch.php \Drupal\node\Plugin\Search\NodeSearch::indexStatus()

Overrides SearchIndexingInterface::indexStatus

File

core/modules/node/src/Plugin/Search/NodeSearch.php, line 571

Class

NodeSearch
Handles searching for node entities using the Search module index.

Namespace

Drupal\node\Plugin\Search

Code

public function indexStatus() {
    $total = $this->database
        ->query('SELECT COUNT(*) FROM {node}')
        ->fetchField();
    $remaining = $this->database
        ->query("SELECT COUNT(DISTINCT n.nid) FROM {node} n LEFT JOIN {search_dataset} sd ON sd.sid = n.nid AND sd.type = :type WHERE sd.sid IS NULL OR sd.reindex <> 0", [
        ':type' => $this->getPluginId(),
    ])
        ->fetchField();
    return [
        'remaining' => $remaining,
        'total' => $total,
    ];
}

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