function apachesolr_date_apachesolr_cck_fields_alter in Apache Solr Search 6.2
Implementation of hook_apachesolr_cck_fields_alter(). This function adds the CCK date fields' definitions to let them be recognized as facets.
File
- contrib/
apachesolr_date/ apachesolr_date.module, line 128 - Integration with the Apache Solr search application. Provides faceting for CCK Date fields.
Code
function apachesolr_date_apachesolr_cck_fields_alter(&$mappings) {
$defaults = array(
'indexing_callback' => 'apachesolr_date_date_field_indexing_callback',
// Trie-Range date types.
'index_type' => 'tdate',
'facet_block_callback' => 'apachesolr_date_date_facet_block',
'display_callback' => 'apachesolr_date_display_callback',
'facets' => TRUE,
);
// NOTE: The structure of this array essentially blocks us from having
// multiple mappings per CCK field. For that we'd need a structure like
// $mappings['date']['date_select'][] = $defaults;
$mappings['date']['date_select'] = $defaults;
$mappings['date']['date_text'] = $defaults;
$mappings['datetime']['date_select'] = $defaults;
$mappings['datetime']['date_text'] = $defaults;
$mappings['datestamp']['date_select'] = $defaults;
$mappings['datestamp']['date_text'] = $defaults;
$mappings['datestamp']['date_select']['indexing_callback'] = 'apachesolr_date_datestamp_field_indexing_callback';
$mappings['datestamp']['date_text']['indexing_callback'] = 'apachesolr_date_datestamp_field_indexing_callback';
if (module_exists('date_popup')) {
$mappings['date']['date_popup'] = $defaults;
$mappings['datetime']['date_popup'] = $defaults;
$mappings['datestamp']['date_popup'] = $defaults;
$mappings['datestamp']['date_popup']['indexing_callback'] = 'apachesolr_date_datestamp_field_indexing_callback';
}
}