You are here

function _apachesolr_realtime_get_env_ids in Apache Solr Real-Time 7

Helper function to fetch the solr environment id(s) of an entity type.

2 calls to _apachesolr_realtime_get_env_ids()
apachesolr_realtime_entity_delete in ./apachesolr_realtime.module
Implements hook_entity_delete().
apachesolr_realtime_index_now in ./apachesolr_realtime.module
Prepare entity as document for adding to Solr index.

File

./apachesolr_realtime.module, line 224
Module file for apachesolr_realtime

Code

function _apachesolr_realtime_get_env_ids($entity_type) {
  $env_ids = array();
  $environments = apachesolr_load_all_environments();
  foreach ($environments as $environment) {
    if (!empty($environment['index_bundles']['node']) && in_array($entity_type, $environment['index_bundles']['node'])) {
      $env_ids[] = $environment['env_id'];
    }
  }

  // If empty at least set the default env for indexing.
  if (empty($env_ids)) {
    $env_ids[] = apachesolr_default_environment();
  }
  return $env_ids;
}