Bixby Developer Center

Guides

natural-order

optional

Specifies how to sort instances of the concept. When used directly on a structure or structure-enum, it is called natural-order and acts as the default.

Example

This sets the default sort order for ratings to show the highest scores first (using the normalized value between 0 and 1). In the event of a tie, it will show the rating with the most votes first. An example output would be:

  1. 10/10 stars, 5 votes
  2. 4/5 stars, 100 votes
  3. 4/5 stars, 50 votes
  4. 3/5 stars, 200 votes
structure (Rating) {
description ("Typical quality rating, generally expressed as stars (4 stars) or
as a fraction (8/10)")
role-of (BaseRating)
property (discretizedScore) {
type (DiscreteStars)
lazy-source (CalculateDiscreteStars)
visibility (Private)
}
natural-order {
direction (DESC)
sort-key (DESC) {
binding (normalizedScore)
}
sort-key (DESC) {
binding (numberOfAggregatedRatings)
}
}
}

Child Keys

direction
optional
Describes the default sort order direction for this structure
name
optional
Name for display
sort-key
optional
A sort-key is a directive that locks onto a concept (the binding) and applies a sort direction (ASC|DESC|MIN|MAX)