Snippet to quickly (re)index search results for a specific node type

30 Apr 2012

Posted by acrollet

Had the need to do this, saving the snippet here.

  1. <?php
  3. $query= db_select('node', 'n')
  4.   ->fields('n', array('nid'))
  5.   ->condition('type', 'content_type_machine_name', '=')
  6.   ->execute();
  7. while ($record = $query->fetchObject()) {
  8.   _node_index_node($record);
  9. }

Blog Tags: 

Add new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.