Skip to content

Fix fetching the correct sort field for relations#548

Open
kskaiser wants to merge 1 commit into
4Science:main-crisfrom
kskaiser:#547-sort-field-fix
Open

Fix fetching the correct sort field for relations#548
kskaiser wants to merge 1 commit into
4Science:main-crisfrom
kskaiser:#547-sort-field-fix

Conversation

@kskaiser
Copy link
Copy Markdown

@kskaiser kskaiser commented May 13, 2026

Description

Having a relation defined in discovery.xml including a sort configuration, the Solr query might fail and no results are provided. This happens, if the metadata field used for sorting is a multi-valued field (e.g., "dc.date.issued").
Instead of adding the plain metadata field, the field type must be considered to get the correct Solr field used for sorting.

References

Instructions for Reviewers

  • Steps to reproduce the behavior:

In discovery.xml in bean "relationAuthorResearchOutputsConfiguration" in the "searchSortConfiguration" set the defaultSortField to "sortDateIssuedDesc", add this sortfield also to the list of sortFields
Then load a researcher profile with the publications. There will not be any results; the layout of the page seems to be of DSpace Core.

List of changes in this PR:

  • First, set the sortField by considering the field type

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & integration tests). Exceptions may be made if previously agreed upon.
  • My PR passes Checkstyle validation based on the Code Style Guide.
  • My PR includes Javadoc for all new (or modified) public methods and classes. It also includes Javadoc for large or complex private methods.
  • My PR passes all tests and includes new/updated Unit or Integration Tests based on the Code Testing Guide.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in any pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR modifies REST API endpoints, I've opened a separate REST Contract PR related to this change.
  • If my PR includes new configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

Having a relation defined in discovery.xml including a sort
configuration, the Solr query might fail and no results are provided.
This happens, if the metadata field used for sorting is a multi-valued
field.
Instead of adding the plain metadata field, the field type must be
considered to get the correct Solr field.

fixes 4Science#547

Signed-off-by: Katharina Kaiser <katharina.kaiser@tuwien.ac.at>
@kskaiser
Copy link
Copy Markdown
Author

@AdamF42 can you please take a look at this?

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.

Loading a relation fails with a configured sort field

1 participant