You are here

date_facets.module in Date Facets 8

Same filename and directory in other branches
  1. 7 date_facets.module

Provides date range facets that are similar to implementations in major search engines.

File

date_facets.module
View source
<?php

/**
 * @file
 * Provides date range facets that are similar to implementations in major search engines.
 */

/**
 * Implements hook_facetapi_facet_info_alter().
 *
 * Associates all date fields with the "date_range" query type.
 */
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';
      }
    }
  }
}

Functions

Namesort descending Description
date_facets_facetapi_facet_info_alter Implements hook_facetapi_facet_info_alter().