Unverified Commit ee6943cf authored by larowlan's avatar larowlan
Browse files

Issue #3087661 by andypost, jhodgdon, pwolanin: Remove pass by reference in NodeSearch plugin

(cherry picked from commit 89e11e4d)
parent 10f8062d
...@@ -497,7 +497,7 @@ public function updateIndex() { ...@@ -497,7 +497,7 @@ public function updateIndex() {
$words = []; $words = [];
try { try {
foreach ($node_storage->loadMultiple($nids) as $node) { foreach ($node_storage->loadMultiple($nids) as $node) {
$this->indexNode($node, $words); $words += $this->indexNode($node);
} }
} }
finally { finally {
...@@ -510,10 +510,12 @@ public function updateIndex() { ...@@ -510,10 +510,12 @@ public function updateIndex() {
* *
* @param \Drupal\node\NodeInterface $node * @param \Drupal\node\NodeInterface $node
* The node to index. * The node to index.
* @param array $words *
* Words that need updating after the index run. * @return array
* An array of words to update after indexing.
*/ */
protected function indexNode(NodeInterface $node, array &$words) { protected function indexNode(NodeInterface $node) {
$words = [];
$languages = $node->getTranslationLanguages(); $languages = $node->getTranslationLanguages();
$node_render = $this->entityTypeManager->getViewBuilder('node'); $node_render = $this->entityTypeManager->getViewBuilder('node');
...@@ -542,6 +544,7 @@ protected function indexNode(NodeInterface $node, array &$words) { ...@@ -542,6 +544,7 @@ protected function indexNode(NodeInterface $node, array &$words) {
// Update index, using search index "type" equal to the plugin ID. // Update index, using search index "type" equal to the plugin ID.
$words += $this->searchIndex->index($this->getPluginId(), $node->id(), $language->getId(), $text, FALSE); $words += $this->searchIndex->index($this->getPluginId(), $node->id(), $language->getId(), $text, FALSE);
} }
return $words;
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment