Find bad nodes during the indexing

Public
</> CopyGet raw version
php
  1. $query = new EntityFieldQuery();
  2.  
  3. $query->entityCondition('entity_type', 'node');
  4.  
  5. $result = $query->execute();
  6.  
  7. if (isset($result['node'])) {
  8. $items_ids= array_keys($result['node']);
  9. $items = entity_load('node', $items_ids);
  10. }
  11. $max_tries = 300;
  12. foreach( $items as $node) {
  13. if( empty($max_tries) ) {
  14. break;
  15. }
  16. $max_tries--;
  17. try{
  18. _node_index_node($node);
  19. }
  20. catch(Exception $e){
  21. $error[] = $node;
  22. }
  23. }
  24.  
  25. dpm( $error );