Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dsim01 created an issue. See original summary.

s.perilhou’s picture

Category: Support request » Bug report

Hi !
Same problem here

Problem

Updated today from 1.20 to 1.21 with the new boost selection (#3201305).
Found that default boost in type-specific boosting screen configuration are all "0.00". Seems that the #default_value is not formatted. Bundles are ok.

Steps to reproduce

  • Fresh install of 1.21.
  • Add server, add index (for content and terms for example).
  • In index processors, enable type-specific boosting
  • Choose weights for default boost and save
  • Show all at "0.00" but values are saved

Proposed resolution

Format default value in TypeBoost::buildConfigurationForm

  $form['boosts'][$datasource_id] = [
    '#type' => 'details',
    '#title' => $this->t('Boost settings for %datasource', ['%datasource' => $datasource->label()]),
    '#open' => TRUE,
    'datasource_boost' => [
    '#type' => 'select',
      '#title' => $this->t('Default boost for items from this datasource'),
      '#options' => $boost_factors,
      '#description' => $this->t('A boost of 1.00 is the default. Assign a boost of 0.00 to not score the item at all.'),
      '#default_value' => Utility::formatBoostFactor($datasource_configurations[$datasource_id]['datasource_boost']),
    ],
  ];
superman369’s picture

We also have the same issue in version 8.x-1.21.

gaddman’s picture

s.perilhou's fix works for the case where a value is set, but still doesn't correctly display or save values where "Use datasource default" has been chosen - these show as 0 and after a save are set to 0.

drunken monkey’s picture

Thanks a lot for reporting this problem, and sorry it took me this long to get back to you.

I could easily reproduce the problem, the attached patch should fix it. Please test/review!

Status: Needs review » Needs work

gaddman’s picture

Tested latest patch in comment #8 and resolves issue for me.

amaria’s picture

Status: Needs review » Reviewed & tested by the community

Works for me as well.

  • drunken monkey committed 472248f on 8.x-1.x
    Issue #3247914 by drunken monkey: Fixed config form of the "Type-...
drunken monkey’s picture

Thanks for the feedback, and sorry for the long delay.
Committed. Thanks again, everyone!

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.