On Sat, Apr 10, 2021 at 02:05:26AM -0700, [email protected] wrote: > Dear alaw, thank you very much for your comment. > My tests show that the sorting of different values for a specific tag is > completely random. I suspect that the sorting is based on a guid value. > I use REST to insert dspace items. I have a sample item with 9 authors. > Every time I run the insert script with postman runner, the order of the > authors changes. I tried adding delays between author value inserts, but > the randomness still continue. So I believe that it is not based on insert > datetime. > > Does anybody have any idea on which part of the code is this behavior > related?
I haven't looked for specific places in the code. Metadata value entries (in the 'metadatavalue' database table) have a 'place' column which can be used to order multiple values of a given metadata field of a given object. So, you could look for code which is aware of the 'place' column. If it has not been thought that the order of values is significant in a specific field, that field may not be sorted by DSpace, either in DSpace code or in database queries. So values might have appropriate 'place' values stored but not used. If an RDBMS query does not request sorting, the values may be returned in whatever order is convenient for the RDBMS, and that order may change over time as the RDBMS reorganizes its data pages. You mention that you are using REST to insert these Items. The REST code adds metadata values to the Item one at a time. (ItemsResource.addItemMetadata) This calls 'DSpaceObjectServiceImpl.addMetadata', which eventually makes an internal call to 'addMetadata(Context context, T dso, MetadataField metadataField, String lang, List<String> values, List<String> authorities, List<Integer> confidences)'. This method sets the 'place' of each new value to the number of values stored for that field, so the 'place' values in the database should be correct for order of entry. But the code which retrieves these values for you may not be using 'place' to sort them. And there is no guaranteed order of retrieval unless a SORT clause is included in the database query. So, I would examine the code that formats an Item's metadata for display in whichever UI you are using. > On Friday, April 9, 2021 at 7:26:08 PM UTC+3 alaw wrote: > > > In my experience, multiple values for the same field are listed in the > > order they were submitted. You can change that order by exporting the > > metadata for that item and changing it in the CSV. > > > > On Thursday, April 8, 2021 at 9:52:12 AM UTC-4 [email protected] wrote: > > > >> Hi, > >> When multiple values are entered in the same metadata tag, what is the > >> sorting method? > >> For example I input three authors to tag dc.contributor.author like below: > >> A,name1 > >> B,name2 > >> C,name3 > >> > >> In which order they are shown in both simple item view or full item view > >> seems random. How can I figure it out? Or does anybody have any idea? > >> Best regards, > >> > > > > -- > All messages to this mailing list should adhere to the Code of Conduct: > https://duraspace.org/about/policies/code-of-conduct/ > --- > You received this message because you are subscribed to the Google Groups > "DSpace Community" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dspace-community/73ef6355-856a-4261-87ca-54f25aa668dcn%40googlegroups.com. -- Mark H. Wood Lead Technology Analyst University Library Indiana University - Purdue University Indianapolis 755 W. Michigan Street Indianapolis, IN 46202 317-274-0749 www.ulib.iupui.edu -- All messages to this mailing list should adhere to the Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/ --- You received this message because you are subscribed to the Google Groups "DSpace Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-community/YHRPeKm6PZyk5xQM%40IUPUI.Edu.
signature.asc
Description: PGP signature
