How to sort a facet in DESC order?

44 views
Skip to first unread message

Diego Brice

unread,
Dec 18, 2024, 12:54:11 AM12/18/24
to DSpace Technical Support
Hi.  Is it possible to sort facet values in DESC order?. I want to have the Date issued facet in descending order. I tried to add the line in red to the bean configuration but it is not valid:

    <bean id="searchFilterIssued" class="org.dspace.discovery.configuration.DiscoverySearchFilterFacet">
        <property name="indexFieldName" value="dateIssued"/>
        <property name="metadataFields">
            <list>
                <value>dc.date.issued</value>
            </list>
        </property>
        <property name="type" value="text"/>
        <property name="facetLimit" value="5"/>
        <property name="sortOrderSidebar" value="VALUE"/>
        <property name="sortOrderFilterPage" value="VALUE"/>
        <property name="isOpenByDefault" value="false"/>
        <property name="pageSize" value="10"/>
        <property name="exposeMinAndMaxValue" value="true"/>
<property name="defaultSortOrder" value="desc"/>
    </bean>

TIA

Diego

Diego Brice

unread,
Dec 20, 2024, 4:14:14 AM12/20/24
to DSpace Technical Support
.

DSpace Technical Support

unread,
Jan 6, 2025, 1:49:07 PM1/6/25
to DSpace Technical Support
Hi Diego,

That setting you've added to org.dspace.discovery.configuration.DiscoverySearchFilterFacet is not valid because there is no "defaultSortOrder" property defined on that Java object https://github.com/DSpace/DSpace/blob/main/dspace-api/src/main/java/org/dspace/discovery/configuration/DiscoverySearchFilterFacet.java

In other words, in that Spring XML configuration, you can only specify properties which exist on the corresponding Java object.

At this time, I'm not aware of a way to configure a facet to support descending order by default.  That'd likely need to be done via custom Java code.

Tim

Reply all
Reply to author
Forward
0 new messages