Each returned item set may contain index items, depending on the other search parameters. Normally, the index items are returned in index order, but user interfaces often allow the final results to be sorted by some secondary criteria, such as date or source or format. The index item sorting is controlled by the following attributes:

<browse docSort="mode" docSortOrder="order" docSortProp="prop"
docSortPropDefault="def" docSortPropVal="val" docSortPred="predicate"
docSortCase="bool"

The mode value specifies how the index items will be sorted, and can be one of the following:

The order value determines whether the sort is ascending or descending, either alphabetically or numerically, depending on the sort mode. The order value can be either ascending or descending.

The prop value specifies the property name to use for the strprop or numprop modes. The property name must be a valid property of the given type; for example, for strprop, either string or enum, and for numprop, either integer, float, boolean or date. Index items that don’t have this property will be excluded from the sort. To prevent that, the def value can specify the default property value to use for these exceptional cases. The def value should agree with the type of the property.

When grouping by property, it is common to have multiple values for a property within an item as well as across a group. The val value controls which value of the result group’s properties to use. The val can be one of the following values:

The default is first. As an example, if the items should be sorted by the lowest price and there are multiple price values per item or the items are grouped by some property, the low value for docSortPropVal should be used.

The predicate value specifies a sequence of sorting modes and orders to apply when mode="predicate", forming a complex sort criterion. The value has the following form:

docSort="predicate" docSortPred="mode:order:prop:def:bool|…"

The five colon-delimited fields correspond to the five docSort attribute values. Note that for modes other than strprop and numprop, the prop and def fields are irrelevant and can be omitted. The order value should specify the logical precedence of the mode, that is, how the results would be placed in order by that individual mode. The bool represents the docSortCase value.

The overall sort order is controlled using the docSortOrder attribute. For example:

docSortPred="numprop:descending:popularity:0|numprop:ascending:cost"
docSortOrder="ascending"

In this example, search results are first sorted descending by popularity, then ascending by cost (for results where popularity is the same).

The docSortCase attribute determines whether any string secondary sorting is case-sensitive (true) or not (false). This attribute affects the docSortmode values of strprop, alpha, url, address, and title. The sort predicate specifies its case-sensitivity within its fielded format.

 
loading table of contents...