You are here

function apachesolr_node_type_insert in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_node_type_insert()

Implements hook_node_type_insert().

Insert our new type into all the environments as indexable bundle type

Parameters

array $info:

File

./apachesolr.module, line 790
Integration with the Apache Solr search application.

Code

function apachesolr_node_type_insert($info) {
  module_load_include('inc', 'apachesolr', 'apachesolr.index');

  // Get all our environments
  $envs = apachesolr_load_all_environments();
  $bundles = array();
  foreach ($envs as $env) {
    if (isset($env['index_bundles']['node'])) {
      $bundles = $env['index_bundles']['node'];
    }

    // Is the bundle already marked?
    if (!in_array($info->type, $bundles)) {
      $bundles[] = $info->type;

      // Set the new bundle as indexable for all environments
      apachesolr_index_set_bundles($env['env_id'], 'node', $bundles);
      apachesolr_environments_clear_cache();
    }
  }
}