You are here

function apachesolr_date_display_callback in Apache Solr Search 6.2

Handles facet text and breadcrumb displays for dates or date ranges.

Parameters

$facet: A date string, eg: 2008-01-01T00:00:00Z or a date range, eg: [2007-01-01T00:00:00Z TO 2008-01-01T00:00:00Z] @param $options An array with a key 'gap' of the form +1YEAR, or +1MONTH etc.

TODO: Why is $options an array?

2 string references to 'apachesolr_date_display_callback'
apachesolr_date_apachesolr_cck_fields_alter in contrib/apachesolr_date/apachesolr_date.module
Implementation of hook_apachesolr_cck_fields_alter(). This function adds the CCK date fields' definitions to let them be recognized as facets.
apachesolr_date_apachesolr_facets in contrib/apachesolr_date/apachesolr_date.module
Implementation of hook_apachesolr_facets(). Only handles end date facets. Start date facet definitions are handled later.

File

contrib/apachesolr_date/apachesolr_date.module, line 446
Integration with the Apache Solr search application. Provides faceting for CCK Date fields.

Code

function apachesolr_date_display_callback($facet, $options) {
  if (preg_match('@[\\[\\{](\\S+) TO (\\S+)[\\]\\}]@', $facet, $match)) {
    return apachesolr_date_format_range($match[1], $match[2]);
  }
  $gap = preg_replace('/^\\+[0-9]+/', '', $options['gap']);
  return apachesolr_date_format_iso_by_gap($gap, $facet);
}