fix: correctly set "multiValued" property in Solr schema for deeply nested fields #11136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This PR fixes a bug in the
/api/admin/index/solr/schema
endpoint reported in #9200. ThemultiValued
property was not set correctly for some deeply nested metadata fields, causing indexing errors:org.apache.solr.common.SolrException: ERROR: [doc=dataset_1479] multiple values encountered for non multiValued field
This is because the code only checked for whether the direct parent of a metadata field is multi-valued to see whether a child metadata field must be declared as multi-valued in the Solr schema. However, all ancestor fields (parents, grandparents, etc.) need to be checked. This PR updates the code to handle deeper metadata nesting properly.
Which issue(s) this PR closes:
This is related to #9200, but doesn't close the issue, because it also describes UI issues related to deeply nested fields, but it's a fix of the Solr schema bug described there.
Special notes for your reviewer:
/
Suggestions on how to test this:
/api/admin/index/solr/schema
to update Solr'sschema.xml
(see https://guides.dataverse.org/en/latest/admin/metadatacustomization.html#updating-the-solr-schema)
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
/
Is there a release notes update needed for this change?:
/
Additional documentation:
/