diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index 062a24d..d11463e 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -123,14 +123,15 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) { node_reindex_node_search($this->id()); } else { - // add to search_dataset for performance when counting nodes to be indexed + // Add to search_dataset for performance when counting nodes to be + // indexed. db_insert('search_dataset') ->fields(array( 'sid' => $this->id(), 'langcode' => $this->language()->getId(), 'type' => 'node_search', 'data' => '', - 'reindex' => 1, // high priority + 'reindex' => 1, )) ->execute(); } diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index 1dbaff2..adbf479 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -415,14 +415,7 @@ public function updateIndex() { // per cron run. $limit = (int) $this->searchSettings->get('index.cron_limit'); - $result = $this->database->queryRange( - "SELECT sid, sd.reindex FROM {search_dataset} sd" - . " WHERE sd.reindex <> 0 AND sd.type = :type" - . " ORDER BY sd.reindex ASC", - 0, - $limit, - array(':type' => $this->getPluginId()), - array('target' => 'replica')); + $result = $this->database->queryRange("SELECT sid, sd.reindex FROM {search_dataset} sd WHERE sd.reindex <> 0 AND sd.type = :type ORDER BY sd.reindex ASC", 0, $limit, array(':type' => $this->getPluginId()), array('target' => 'replica')); $nids = $result->fetchCol(); if (!$nids) { return; @@ -488,11 +481,7 @@ public function markForReindex() { */ public function indexStatus() { $total = $this->database->query('SELECT COUNT(*) FROM {node}')->fetchField(); - $remaining = $this->database->query( - "SELECT COUNT(DISTINCT sd.sid) FROM {search_dataset} sd" - . " WHERE sd.reindex <> 0 AND sd.type = :type", - array(':type' => $this->getPluginId())) - ->fetchField(); + $remaining = $this->database->query("SELECT COUNT(DISTINCT sd.sid) FROM {search_dataset} sd WHERE sd.reindex <> 0 AND sd.type = :type", array(':type' => $this->getPluginId()))->fetchField(); return array('remaining' => $remaining, 'total' => $total); }