You are here

function apachesolr_stats_get_active_facets in Apache Solr Statistics 7

Same name and namespace in other branches
  1. 6.3 apachesolr_stats.module \apachesolr_stats_get_active_facets()

Gets the searcher's active facets from Facet API.

Parameters

$searcher: The machine name of the searcher.

Return value

array An array keyed by facet name to value.

1 call to apachesolr_stats_get_active_facets()
apachesolr_stats_exit in ./apachesolr_stats.module
Implements hook_exit().

File

./apachesolr_stats.module, line 239
Keeps and reports statistics about Apache Solr usage and performance.

Code

function apachesolr_stats_get_active_facets($searcher) {
  $filters = array();
  if (function_exists('facetapi_adapter_load')) {
    if ($adapter = facetapi_adapter_load($searcher)) {
      $active = $adapter
        ->getAllActiveItems();
      foreach ($active as $filter) {
        foreach ($filter['facets'] as $facet_name) {
          $filters[$facet_name] = $filter['value'];
        }
      }
    }
  }
  return $filters;
}