@j_nunes The point is apache solr module considers custom field as multivalue...

Contribution Date
Technology
Contribution Project
Contribution Details

@j_nunes The point is apache solr module considers custom field as multivalued, nevertheless the field is single valued. You can see apachesolr_get_field_mappings($entity_type) in apachesolr.module. What you can do is alter field mapping for the custom field. See the code:

/** * Implements hook_apachesolr_field_mappings_alter(). */ function my_module_apachesolr_field_mappings_alter(array &$mappings, $entity_type) { // By default every custom field is considered as a multivalued solr field. // @see apachesolr_get_field_mappings($entity_type) // We check here whether `field_date` is set to multivalued or not, and // according to that we change the cardinality of solr field. $field_date = field_info_field('field_date'); if (!empty($field_date) && $field_date['cardinality'] == 1) { $mappings['per-field']['field_date'] = $mappings['date']; $mappings['per-field']['field_date']['multiple'] = FALSE; } }

This way you can alter the cardinality of a solr field.

Issue Status
Active
Contribution Author
Files count
0
Patches count
0