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

Advanced search page does not use the display order of the metadata fields #11272

Open
PaulBoon opened this issue Feb 18, 2025 · 3 comments · May be fixed by #11279
Open

Advanced search page does not use the display order of the metadata fields #11272

PaulBoon opened this issue Feb 18, 2025 · 3 comments · May be fixed by #11279
Labels
Type: Bug a defect

Comments

@PaulBoon
Copy link
Contributor

PaulBoon commented Feb 18, 2025

When adding a new inputfield to an existing custom metdatablock, via the TSV file upload, the Metadata edit and Dataset create forms do respect the configured 'displayorder'. So when adding a new field and giving it an order '0' and renumber the others, the new field is displayed at the top of the metadatablock.
However, the Advanced Search page, does always show this new field at the bottom of the metadatablock.

The function that is responsible for this is findAllAdvancedSearchFieldTypes in edu/harvard/iq/dataverse/DatasetFieldServiceBean.java:

public List<DatasetFieldType> findAllAdvancedSearchFieldTypes() {

It is doing an order by o.id resulting in the later added new field ending at the bottom. If the function is changed to do order by o.displayOrder,o.id, the problem is resolved.

    public List<DatasetFieldType> findAllAdvancedSearchFieldTypes() {
        return em.createQuery("select object(o) from DatasetFieldType as o where o.advancedSearchFieldType = true and o.title != '' order by o.displayOrder,o.id", DatasetFieldType.class).getResultList();
    }
@PaulBoon PaulBoon added the Type: Bug a defect label Feb 18, 2025
@qqmyers
Copy link
Member

qqmyers commented Feb 19, 2025

Sounds reasonable that the advanced search page should use displayOrder - are you making a PR?

@PaulBoon
Copy link
Contributor Author

Ok, sorry, I wrongfully created the PR at DANS-KNAW first, but removed it there

@PaulBoon
Copy link
Contributor Author

My only concern is that this code has been in there for 10+ years, so might there be some side effects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug a defect
Projects
None yet
2 participants