Last active
February 17, 2016 02:42
-
-
Save robmint/2f08b96d41ffff214087 to your computer and use it in GitHub Desktop.
Adding custom fields to a Solr schema to enable sorting and grouping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- typical filesystem location ../config/spring/api/discovery.xml --> | |
<!-- sort filters for the discovery search--> | |
<property name="searchSortConfiguration"> | |
<bean class="org.dspace.discovery.configuration.DiscoverySortConfiguration"> | |
<property name="defaultSortOrder" value="desc"/> | |
<property name="sortFields"> | |
<list> | |
<ref bean="sortTitle" /> | |
<ref bean="sortDateIssued" /> | |
<ref bean="sortSomeField" /> | |
</list> | |
</property> | |
</bean> | |
</property> | |
<!-- followed by the definitions of the properties later in the saem file --> | |
<!--Sort properties--> | |
<bean id="sortTitle" class="org.dspace.discovery.configuration.DiscoverySortFieldConfiguration"> | |
<!-- definition below defaults to sort by alpha --> | |
<property name="metadataField" value="dc.title"/> | |
</bean> | |
<bean id="sortDateIssued" class="org.dspace.discovery.configuration.DiscoverySortFieldConfiguration"> | |
<!-- in this case we want to sort by date, so that is specified explicitly --> | |
<property name="metadataField" value="dc.date.issued"/> | |
<property name="type" value="date"/> | |
</bean> | |
<bean id="sortSomeField" class="org.dspace.discovery.configuration.DiscoverySortFieldConfiguration"> | |
<!-- here we explicitly type the field as an integer --> | |
<property name="metadataField" value="dc.some.field"/> | |
<property name="type" value="integer"/> | |
</bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment