You are here

function apachesolr_stats_get_facets in Apache Solr Statistics 7

Same name and namespace in other branches
  1. 6.3 apachesolr_stats.module \apachesolr_stats_get_facets()
  2. 6 apachesolr_stats.module \apachesolr_stats_get_facets()

Returns the facet array to report on.

1 call to apachesolr_stats_get_facets()
apachesolr_stats_generate_report_elements in ./apachesolr_stats.module
Generates report elements for the given granularity.

File

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

Code

function apachesolr_stats_get_facets() {
  $facets = array();
  if (module_exists('facetapi')) {
    $environments = apachesolr_load_all_environments();
    foreach ($environments as $env_id => $environment) {
      $searcher = 'apachesolr@' . $env_id;
      foreach (facetapi_get_enabled_facets($searcher) as $facet_name => $facet) {
        $facets[$facet_name] = array(
          'facet_field' => $facet['field'],
          'info' => $facet['label'],
          'usage' => 0,
        );
      }
    }
  }

  // Add some "virtual" facets to report on.
  $facets['kw'] = array(
    'facet_field' => 'kw',
    'info' => 'Keyword search',
    'usage' => 0,
  );
  $facets['any'] = array(
    'facet_field' => 'any',
    'info' => '[All queries including any filter and/or keywords]',
    'usage' => 0,
  );

  /*
  $facets['none'] = array(
    'facet_field' => 'none',
    'info' => '[Clickthrus with no previous queries]',
  );
  */
  return $facets;
}