You are here

function facetapi_apachesolr_facetapi_facet_term_build in Facet API 6

Implementation of hook_facetapi_facet_QUERY_TYPE_build().

File

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

Code

function facetapi_apachesolr_facetapi_facet_term_build(FacetapiAdapter $adapter, array $facet) {
  $build = array();
  if ($response = apachesolr_static_response_cache()) {
    $values = (array) $response->facet_counts->facet_fields->{$facet['field']};
    foreach ($values as $value => $count) {
      $build[$value] = array(
        '#count' => $count,
      );
    }
  }
  return $build;
}