3

I would need to sort the items displayed on the XMLUI discovery page using a combination of metadata, because the type of ordering required (specifically for size) uses a different metadata for media type of reference (see images, audio, video ...) .

Wanting to act, as per documentation, on the file "discovery.xml" but specifying a bean of this type:

<bean id="sortSize" class="org.dspace.discovery.configuration.DiscoverySortFieldConfiguration">
   <property name="metadataFields"/>
      <list>
         <value>METADATA_NAME_1</value>
         <value>METADATA_NAME_2</value>
         ...
      </list>
   </property>
</bean>

Indexing is not successful. This is because it is only possible to indicate a sort bean of this type:

<bean id="sortSize" class="org.dspace.discovery.configuration.DiscoverySortFieldConfiguration">
   <property name="metadataField" value="SINGLE_METADATA_NAME"/>
</bean>

Is it possible to create a type of combined ordering like the one described? If so, how could I operate?

Thank you in advance!

2 Answers2

2

Sorting via a list of metadataFields currently isn't possible in DSpace's Discovery module.

DiscoverySortFieldConfiguration only supports a single metadataField as noted in the documentation at: https://wiki.duraspace.org/display/DSDOC6x/Discovery#Discovery-Sortoptioncustomizationforsearchresults

You can also see that the code itself only supports one field: https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace-api/src/main/java/org/dspace/discovery/configuration/DiscoverySortFieldConfiguration.java#L17

Tim Donohue
  • 542
  • 4
  • 14
  • Thanks Tim for your response. At this point, I would ask you if there is a possibility to customize this behaviour. – Eustachio Maselli Nov 27 '18 at 16:38
  • 1
    @EustachioMaselli : All code in DSpace is open source, so it could be customized. However, the existing code in Discovery has a lot of areas where the assumption is that sort is only on a single field. So, you'd literally need to look at everywhere `DiscoverySortFieldConfiguration` is used, and ensure it can be updated to allow for multiple sort fields. – Tim Donohue Nov 29 '18 at 14:42
1

it's easy. You should try with the order by clause of Dspace. What version are you using?

  • Hi John, the version we are using is 4.1 – Eustachio Maselli Nov 27 '18 at 16:56
  • 1
    This is more of a comment than an answer. –  Nov 27 '18 at 17:03
  • Just a question Ystacchio, do you use MVC in your project? – John Andrew P. Cursor Nov 28 '18 at 09:13
  • 1
    @JohnAndrewP.Cursor: This answer is incorrect when it comes to the DSpace Discovery module. It sounds like you are talking more about sorting in *database queries* (which can be achieved by customizing SQL "order by" clauses). The DSpace Discovery module doesn't use the database, but instead queries against a Solr backend. So SQL "order by" clauses will not help in that module. (However, if the original question was about sorting DSpace database queries, then this answer would be correct.) – Tim Donohue Nov 29 '18 at 14:47