function apachesolr_date_datestamp_field_indexing_callback in Apache Solr Search 6.2
This function is used during indexing to normalize the DATESTAMP fields into the appropriate format for Apache Solr.
1 string reference to 'apachesolr_date_datestamp_field_indexing_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.
File
- contrib/
apachesolr_date/ apachesolr_date.module, line 200 - Integration with the Apache Solr search application. Provides faceting for CCK Date fields.
Code
function apachesolr_date_datestamp_field_indexing_callback($node, $field_name, $cck_info) {
$fields = array();
if (isset($node->{$field_name})) {
$index_key = apachesolr_index_key($cck_info);
// $fields may end up having two values; one for the start date
// and one for the end date.
foreach ($node->{$field_name} as $field) {
if (isset($field['value']) && $field['value'] != 0) {
$index_value = apachesolr_date_iso($field['value']);
$fields[] = array(
'key' => $index_key,
'value' => $index_value,
);
}
if (isset($field['value2']) && $field['value'] != 0) {
$index_value = apachesolr_date_iso($field['value2']);
$fields[] = array(
// The value2 element is the end date. Therefore it gets indexed
// into its own Solr field.
'key' => $index_key . '_end',
'value' => $index_value,
);
}
}
}
return $fields;
}