You are here

function facetapi_apachesolr_facetapi_facet_info_alter in Facet API 6

Implementation of hook_facetapi_facet_info_alter().

Modifies fields for vocabulary facets.

File

contrib/facetapi_apachesolr/facetapi_apachesolr.module, line 54
The Apache Solr Search Integration module's implementation of the the Facet API.

Code

function facetapi_apachesolr_facetapi_facet_info_alter(array &$facets, $searcher, $type) {
  if ('apachesolr_search' == $searcher) {
    foreach ($facets as &$facet) {
      if (preg_match('/^vocabulary_(\\d+)$/', $facet['name'], $matches)) {
        $facet['field'] = 'im_vid_' . $matches[1];
        $facet['field alias'] = 'tid';
      }
    }
    unset($facet);
  }
}