When adding a per-field definition, it is mot adding the default configuration correctly to the fields

Comments

nick_vh’s picture

StatusFileSize
new1.64 KB
nick_vh’s picture

Status: Active » Patch (to be ported)

Fixed for d7

nick_vh’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
nick_vh’s picture

Status: Patch (to be ported) » Fixed

Committed for 6.x-3.x

nick_vh’s picture

Status: Fixed » Closed (fixed)
asgorobets’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (fixed) » Needs review
StatusFileSize
new832 bytes

I guess the issue is back since commit 1f7d222d in 7.x-1.x.


foreach (array_keys($mappings) as $key) {
      // Set all values with defaults.
      $defaults = array(
        'dependency plugins' => array('bundle', 'role'),
        'map callback' => FALSE,
        'name callback' => '',
        'hierarchy callback' => FALSE,
        'indexing_callback' => '',
        'index_type' => 'string',
        'facets' => FALSE,
        'facet missing allowed' => FALSE,
        'facet mincount allowed' => FALSE,
        // Field API allows any field to be multi-valued.
        'multiple' => TRUE,
      );
      if ($key !== 'per-field') {
        $mappings[$key] += $defaults;
      }
      else {
        foreach (array_keys($field_mappings[$key]) as $field_key) {
          $mappings[$key][$field_key] += $defaults;
        }
      }

This part is looping a wrong array:

foreach (array_keys($field_mappings[$key]) as $field_key) {
   $mappings[$key][$field_key] += $defaults;
}

Should loop throw $mappings[$key].

foreach (array_keys($mappings[$key]) as $field_key) {
   $mappings[$key][$field_key] += $defaults;
}
sergiu.savva’s picture

Works like a charm. Thank you asgorobets

heacu’s picture

Indeed, I just noticed this myself. Still true of 7.x-1.6.

mkalkbrenner’s picture

Title: Default values for for mapping per-field is not added correctly » Default values for mapping per-field is not added correctly
Status: Needs review » Reviewed & tested by the community
Issue tags: +RTBC

#6 is RTBC

The last submitted patch, 1: 1429230-1.patch, failed testing.

asgorobets’s picture

Rerolling #6

asgorobets’s picture

Status: Reviewed & tested by the community » Needs review
mkalkbrenner’s picture

Status: Needs review » Reviewed & tested by the community

Still RTBC ;-)

gbirch’s picture

This patch does not fix all problems. I still get:
Warning: array_keys() expects parameter 1 to be array, null given in apachesolr_get_field_mappings() (line 2193 of .../sites/all/modules/apachesolr/apachesolr.module).

Could fix this by replacing

else {

with
elseif (is_array($mappings[$key])) {
at line 2192

I apologize for not having time right how to roll a patch.

mkalkbrenner’s picture

Version: 7.x-1.x-dev » 7.x-1.6
Status: Reviewed & tested by the community » Closed (duplicate)