Created
June 7, 2020 03:22
-
-
Save crittermike/7233a55079cd112d51d44ce0d1939ec6 to your computer and use it in GitHub Desktop.
Rebuild taxonomy_index table for all nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = \Drupal::entityQuery('node'); | |
$ids = $query->accessCheck(FALSE)->execute(); | |
$storage_handler = \Drupal::entityTypeManager()->getStorage('node'); | |
// If you have a lot of nodes, you may have to split this up via | |
// array_chunk() instead of trying to load all nodes at one time. | |
$entities = $storage_handler->loadMultiple($ids); | |
foreach ($entities as $entity) { | |
taxonomy_build_node_index($entity); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment