When testing the patch for a hierarchical entity processor (https://www.drupal.org/node/2625152), the following error occurs:
Solarium\Exception\HttpException while indexing: Solr HTTP error: OK (400) {"responseHeader":{"status":400,"QTime":0},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"ERROR: [doc=qcwize-solr-entity:node/34445:nl] multiple values encountered for non multiValued field its_publication_type: [2201, 2198]","code":400}} in Solarium\Core\Query\Result\Result->__construct() (line 106 of /var/www/FRIS/vendor/solarium/solarium/library/Solarium/Core/Query/Result/Result.php).
I have a single value field "publication_type" which is a taxonomy term reference. I enabled hierarchical indexing for it.
Should the field be configured as a multiple field or is there a bug in search_api_solr?
see remark by @drunkenmonkey on https://www.drupal.org/node/2625152#comment-11630651:
@ mpp: I'm pretty sure that's just a bug in the Solr backend – the Search API doesn't care about single-valued vs. multi-valued fields anymore. So, unless you can reproduce it with the database backend, you should report it in the Solr module's issue queue.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2801765_including_test.patch | 8.54 KB | mkalkbrenner |
#5 | 2801765.patch | 5.98 KB | mkalkbrenner |
Comments
Comment #2
mkalkbrennerObviously the field isn't really single valued. Mybe that's caused by this new patch. I think we should wait for the final patch before starting debugging.
Comment #3
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedThe new patch indeed makes a previously single valued field in Drupal (= field with 1 term reference e.g. "book type") a multiValued property in SOLR (i.c. "book type" + all ancestor types).
We should probably force hierarchical fields to be multivalued in SOLR.
Comment #4
mkalkbrennerYes. Therfor we need to extend the logic of SearchApiSolrBackend::getSolrFieldNames() to set fields that are "potentially" hierarchical to multi-valued. That requires to copy some logic of the \Drupal\search_api\Plugin\search_api\processor\AddHierarchy class.
If someone wants to help to get the beta release out faster, we need a test that reproduces the issue first.
Comment #5
mkalkbrennerHere's a first patch, but not tested at all. Please provide some feedback.
Comment #6
mpp CreditAttribution: mpp as a volunteer and at AmeXio commented@mkalkbrenner, tested it with a single valued taxonomy term reference (publication_type) which has hierarchical terms, with the patch I no longer see the
multiple values encountered for non multiValued field
error.Comment #7
mkalkbrennerI added a test but it requires #2821955: Prepare processor tests to be executed on different backends.
Comment #8
mkalkbrennerhttps://travis-ci.org/mkalkbrenner/search_api_solr/builds/170599005
Comment #10
mkalkbrennerComment #11
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedThanks!