/** * Implements hook_update_index(). */ function {{ machine_name }}_update_index() { $limit = (int)variable_get('search_cron_limit', 100); $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit); foreach ($result as $node) { $node = node_load($node->nid); // Save the changed time of the most recent indexed node, for the search // results half-life calculation. variable_set('node_cron_last', $node->changed); // Render the node. node_build_content($node, 'search_index'); $node->rendered = drupal_render($node->content); $text = '