Array to string warning when spellchecking negated keyword

Created on 31 July 2025, 29 days ago

Setup

  • Solr version: 9.6.1
  • Drupal Core version: 10.
  • Search API version: 10.4.8
  • Search API Solr version: 4.3.10
  • Configured Solr Connector: Standard

Issue

I have spellcheck enabled and I see the following warning when negating a keyword search (-) using Multiple Words parse mode:

Warning: Array to string conversion in Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend->setSpellcheck() (line 4572 of modules/contrib/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php).

This is caused because $spellcheck_options['keys'] is assumed to be a simple associative array, but the negated keyword value is an array, for example: "apple -banana" is represented as:

$spellcheck_options['keys'][
 0 => 'apple',
 1 => [
    #negation => true,
    #conjunction => 'AND',
    0 => 'banana'
  ],
]
πŸ› Bug report
Status

Active

Version

4.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States amanire

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024