Skip to content

Commit

Permalink
Replace call to core search index function with rendering all nodes. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jastraat committed Jun 5, 2023
1 parent 5c66d3b commit 90fe1ca
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,21 @@ private function runQueues(array $relevantQueues = []) {
}
}

// Retrieve node search plugin for updating node page indexes.
$node_search_plugin = $this->container->get('plugin.manager.search')->createInstance('node_search');
$node_search_plugin->updateIndex();
// Render all the dataset nodes to address cache.
$renderer = \Drupal::service('renderer');
$entityTypeManager = \Drupal::service('entity_type.manager');

$database_service = \Drupal::service('database');
$query = $database_service->select('node', 'n');
$query->addField('n', 'nid');
$nids = $query->execute()->fetchCol();

$node_storage = $entityTypeManager->getStorage('node');
$node_render = $entityTypeManager->getViewBuilder('node');
foreach ($node_storage->loadMultiple($nids) as $node) {
$build = $node_render->view($node);
$text = $renderer->renderPlain($build);
}
}

private function httpVerbHandler(string $method, RootedJsonData $json, $dataset) {
Expand Down

0 comments on commit 90fe1ca

Please sign in to comment.