Setup
- Solr version:
- Drupal Core version:
- Search API version:
- Search API Solr version:
- Configured Solr Connector:
8
9.4.7
1.26
4.2.9
Issue
I am receiving this warning message
Warning: Array to string conversion in Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend->extractResults() (line 2922 of modules/contrib/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php).
It seems that it is because $doc_fields['hash'] can sometimes be an array.
Like the solution in this issue https://www.drupal.org/project/search_api_solr/issues/3281703 I have added a patch that checks if this is as an array and then get the current index of the array. The patch attached may only apply if the patch from the MR in 3281703 is also applied.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | array-to-string-conversion-issue-fix-3320713-8.patch | 1.06 KB | rajivgandhi chinnakrishnan |
Comments
Comment #2
mkalkbrennerBefore I commit that patch, can you please check the Solr schema that is in use?
I wonder if these errors are caused by using Solr's default managed schema instead of the scheme this module provides.
That default schema uses a string multiple type for everything.
Comment #3
mkalkbrennerComment #4
rastepanyan commentedThe approach implemented in the patch above is working for me. I have created a patch compatible with Search API Solr version 4.2.1, which I'm using together with Search API version 1.23. The PHP version is 7.4.30, MySQL version is 5.5 and the Drupal Core version is 8.9.20.
Comment #5
mkalkbrennerComment #7
mkalkbrennerComment #8
rajivgandhi chinnakrishnan commentedCreated a new patch for the Search API Solr version 4.2.12.