Undefined array key "boosts" error in BoostMoreRecent and NumberFieldBoost, rather than an explanation

Created on 10 October 2024, 10 months ago

Respect the submission guidelines above! Drupal.org issue forks cause additional work for the project maintainer!

Setup

  • Solr version: 9.6.1
  • Drupal Core version: 10.2.8
  • Search API version: 1.35
  • Search API Solr version: 4.3.5
  • Configured Solr Connector: Solr Cloud with Basic Auth (using ddev add-on)

Issue

I was looking at BoostMoreRecent and NumberFieldBoost as a template for making my own search_api processor for Solr, but they throw errors such as:

Warning: Undefined array key "boosts" in Drupal\search_api_solr\Plugin\search_api\processor\BoostMoreRecent->submitConfigurationForm() (line 118 of modules/contrib/search_api_solr/src/Plugin/search_api/processor/BoostMoreRecent.php).

I found 🐛 Undefined array key "boosts" in BoostMoreRecent.php Fixed which tells us that things will work without error if you have the proper field types already, but I have to say that throwing a PHP error rather than an explanation doesn't seem all that kind to developer or users.

It seems like defaultConfiguration() would get called regardless of whether a given field is of a specific type, but I guess not. Is there some way to fix this so that the notice says something nice instead of PHP error?

🐛 Bug report
Status

Active

Version

4.3

Component

Code

Created by

🇺🇸United States mile23 Seattle, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024