You are here

function apachesolr_index_set_bundles in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr.index.inc \apachesolr_index_set_bundles()
  2. 7 apachesolr.index.inc \apachesolr_index_set_bundles()

Sets what bundles on the specified entity type should be indexed.

Parameters

string $env_id: The Solr core for which to index entities.

string $entity_type: The entity type to index.

array $bundles: The machine names of the bundles to index.

Throws

Exception

8 calls to apachesolr_index_set_bundles()
apachesolr_environment_save in ./apachesolr.module
Function that saves an environment
apachesolr_index_config_form_submit in ./apachesolr.admin.inc
Submit handler for the bundle configuration form.
apachesolr_install in ./apachesolr.install
Implements hook_install().
apachesolr_node_type in ./apachesolr.module
Implements hook_node_type().
apachesolr_update_6302 in ./apachesolr.install
This function cleans up the old apachesolr tables. There is no magic upgrade pat. The old facet and MLT blocks will be gone

... See full list

File

./apachesolr.index.inc, line 706
Functions related to Apache Solr indexing operations.

Code

function apachesolr_index_set_bundles($env_id, $entity_type, array $bundles) {

  // @todo - need a lock?
  $query = "DELETE FROM {apachesolr_index_bundles} WHERE env_id = '%s' AND entity_type = '%s'";
  db_query($query, array(
    $env_id,
    $entity_type,
  ));
  if ($bundles) {
    foreach ($bundles as $bundle) {
      $query = "INSERT INTO {apachesolr_index_bundles} (env_id, entity_type, bundle) VALUES ('%s', '%s', '%s')";
      db_query($query, array(
        $env_id,
        $entity_type,
        $bundle,
      ));
    }
  }
}