You are here

function date_facets_facetapi_facet_info_alter in Date Facets 8

Same name and namespace in other branches
  1. 7 date_facets.module \date_facets_facetapi_facet_info_alter()

Implements hook_facetapi_facet_info_alter().

Associates all date fields with the "date_range" query type.

File

./date_facets.module, line 13
Provides date range facets that are similar to implementations in major search engines.

Code

function date_facets_facetapi_facet_info_alter(array &$facet_info, array $searcher_info) {
  if ('apachesolr' == $searcher_info['adapter']) {
    foreach ($facet_info as $name => $info) {
      $query_types = array_flip($info['query types']);
      if (isset($query_types['date'])) {
        $facet_info[$name]['query types'][] = 'date_range';
      }
    }
  }
}