You are here

function apachesolr_multisitesearch_query_bundles in Apache Solr Multisite Search 7

Same name and namespace in other branches
  1. 6.3 apachesolr_multisitesearch.module \apachesolr_multisitesearch_query_bundles()

Returns available bundle names.

Return value

array An array listing all of the bundle names for content types.

TODO: Separate content types by site, and allow for exclusions by site.

3 calls to apachesolr_multisitesearch_query_bundles()
apachesolr_multisitesearch_apachesolr_query_alter in ./apachesolr_multisitesearch.module
Implements hook_apachesolr_query_alter().
apachesolr_multisitesearch_exclude_indexes in ./apachesolr_multisitesearch.admin.inc
Submit handler for the "Exclude content types" button.
apachesolr_multisitesearch_settings in ./apachesolr_multisitesearch.admin.inc
Creates the form that allows the user to select which facets will be enabled.

File

./apachesolr_multisitesearch.module, line 196
Provides a multi-site search implementation for use with the Apache Solr module

Code

function apachesolr_multisitesearch_query_bundles() {
  $query_bundle_names = array();

  // Check variables for the metadata which contains the bundles and bundle
  // names.
  $sites = variable_get('apachesolr_multisitesearch_metadata', array());
  if (isset($sites) && !empty($sites)) {

    // Iterates for each site available in the multi-site search
    foreach ($sites as $key => $value) {

      // Grabs all of the bundle names and save them.
      foreach ($value['sm_multisite_meta_bundles'] as $bundle_name) {
        $query_bundle_names[] = $bundle_name;
      }
    }

    // Sort the bundle names for user readability. Sorting is done here so
    // mapping keys to values later happens properly.
    sort($query_bundle_names);
  }
  $query_bundle_names = array_unique($query_bundle_names);
  return $query_bundle_names;
}