-
Notifications
You must be signed in to change notification settings - Fork 32
Enhancements in "sorting" feature #448
Description
Problem description
Current Commonalities Sorting section indicates
This section is moved without changes to the new Commonalities refactor in PR #441 into section ### 4.2. Sorting.
Around this section a fair point has been raised about the default value for order
This issue is open to discuss and agree in clarifications for the default value for this concept to be added in new section ### 4.2. Sorting, once PR#441 is merged.
Some background:
-
When indicating this definition probably it was mainly thinking in dates or numerical concepts for orderBy where it makes sense to have descending order as default (most recent items first, higher values first).
-
However, when the concept is a "string" (alphanumeric value), it makes sense to be ascending order (from "a" to "z", from "0" to "9").
For combination scenarios (sorting by more than one concept), could be several ways. I think two options would be reasonable from beginning:
- Delegate to the API WG and document in the API
- Model order "default" value based on the nature of the first concept indicated in orderBy
Possible evolution
Enhance the rules for order default value:
- When
orderByonly contains an attribute:- In case it represents a
date,date-timeornumericattribute:orderdefault value isdesc. - In case it represents a
stringalphanumeric attribute:orderdefault value isasc.
- In case it represents a
- When
orderBycontains several attributes:orderdefault value is decided based on the nature of the first attribute, according to previous bullet, as aligned and agreed in the specific API Working Group for the API. Therefore it is needed to agree in the first attribute to be indicated (*)- Specific considerations about sorting logic can be decided upon internal agreement in the specific API Working Group
(*) Otherwise we would need to think in a flexible model indicating the default order value for each orderBy attribute allowed, and based on the attributes indication in the query, apply that ordering.
Alternative solution
Based on discussion
Additional context
NOTE: For the second bullet (When orderBy contains several attributes:) currently there are no real use cases in CAMARA yet. Other option is to not define this yet and not allowed this option.
