diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index ffbae26..dac7b88 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -9,7 +9,6 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Access\AccessResult; -use Drupal\Core\Cache\Cache; use Drupal\Core\Config\Config; use Drupal\Core\Database\Connection; use Drupal\Core\Database\Query\SelectExtender; @@ -319,10 +318,6 @@ protected function prepareResults(StatementInterface $found) { SafeMarkup::escape($this->moduleHandler->invoke('comment', 'node_update_index', array($node, $item->langcode))) ); - $nodeCacheTags = $node->getCacheTags(); - $ownerCacheTags = $node->getOwner()->getCacheTags(); - $cacheTags = array_merge($nodeCacheTags, $ownerCacheTags); - $extra = $this->moduleHandler->invokeAll('node_search_result', array($node, $item->langcode)); $language = $this->languageManager->getLanguage($item->langcode); @@ -341,7 +336,7 @@ protected function prepareResults(StatementInterface $found) { 'score' => $item->calculated_score, 'snippet' => search_excerpt($keys, $node->rendered, $item->langcode), 'langcode' => $node->language()->getId(), - 'cache_tags' => $cacheTags + 'cache_tags' => $build['#cache']['tags'] ); } return $results; diff --git a/core/modules/search/src/Plugin/SearchPluginBase.php b/core/modules/search/src/Plugin/SearchPluginBase.php index 1354bab..e0bd857 100644 --- a/core/modules/search/src/Plugin/SearchPluginBase.php +++ b/core/modules/search/src/Plugin/SearchPluginBase.php @@ -108,7 +108,7 @@ public function buildResults() { '#result' => $result, '#plugin_id' => $this->getPluginId(), ); - $built['cache_tags'] = array_merge($built['cache_tags'],$result['cache_tags']); + $built['cache_tags'] = array_merge($built['cache_tags'], $result['cache_tags']); } return $built; diff --git a/core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php b/core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php index 5c97934..e5c61b4 100644 --- a/core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php +++ b/core/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php @@ -77,7 +77,7 @@ public function buildResults() { $output['prefix']['#markup'] = '