function facetapi_apachesolr_facetapi_query_date_prepare in Facet API 6
Implementation of hook_facetapi_query_QUERY_TYPE_prepare().
File
- contrib/
facetapi_apachesolr/ facetapi_apachesolr.module, line 106 - The Apache Solr Search Integration module's implementation of the the Facet API.
Code
function facetapi_apachesolr_facetapi_query_date_prepare(FacetapiAdapter $adapter, array $facet, &$params, $query) {
$searcher = $adapter
->getSearcher();
// Gets the data range in formats that Solr understands.
list($start, $end, $gap) = facetapi_apachesolr_date_range($query, $facet['field']);
$params['facet.date'][] = $facet['field'];
$params['f.' . $facet['field'] . '.facet.date.start'] = $start;
$params['f.' . $facet['field'] . '.facet.date.end'] = $end;
$params['f.' . $facet['field'] . '.facet.date.gap'] = $gap;
// Adds "hard limit" parameter to prevent too many return values.
$limit = facetapi_setting_get('hard_limit', $searcher, '', $facet['name']);
$params['f.' . $facet['field'] . '.facet.limit'] = $limit !== NULL ? (int) $limit : 20;
}