You are here

function apachesolr_facetapi_facet_info in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.module \apachesolr_facetapi_facet_info()
  2. 7 apachesolr.module \apachesolr_facetapi_facet_info()

Implements hook_facetapi_facet_info(). Currently it only supports the node entity type

File

./apachesolr.module, line 334
Integration with the Apache Solr search application.

Code

function apachesolr_facetapi_facet_info($searcher_info) {
  $facets = array();
  if ('apachesolr' == $searcher_info['adapter']) {
    $environment = apachesolr_environment_load($searcher_info['instance']);
    if (!empty($environment['conf']['facet callbacks'])) {
      foreach ($environment['conf']['facet callbacks'] as $callback) {
        if (is_callable($callback)) {
          $facets = array_merge($facets, call_user_func($callback, $searcher_info));
        }
      }
    }
    elseif (isset($searcher_info['types']['node'])) {
      $facets = apachesolr_default_node_facet_info();
    }
  }
  return $facets;
}