Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly set "multiValued" property in Solr schema for deeply nested fields #11136

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vera
Copy link
Contributor

@vera vera commented Jan 8, 2025

What this PR does / why we need it:

This PR fixes a bug in the /api/admin/index/solr/schema endpoint reported in #9200. The multiValued 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:

  1. Upload TSV metadata block file e.g. nested_compound_test2.csv (had to rename to CSV to upload here)
  2. Activate metadata block
  3. Use /api/admin/index/solr/schema to update Solr's schema.xml
  4. Reload Solr

(see https://guides.dataverse.org/en/latest/admin/metadatacustomization.html#updating-the-solr-schema)

  1. Upload dataset as JSON e.g. nested_compound_test2.json
  2. Confirm the dataset indexes without errors

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:

/

@coveralls
Copy link

Coverage Status

coverage: 22.695% (+0.002%) from 22.693%
when pulling e7cd128 on vera:fix/9200-allowmultiples-for-deep-nesting
into 3352bb7 on IQSS:develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants