Applicable to the string
, enum
and date
attribute types.
The attributes by which the CMS objects should be ordered must be contained in the objects themselves. Attributes in widgets part of the objects are not considered, meaning that you cannot have CMS objects ordered by an attribute belonging to a widget inside of the objects. This prevents unintended ordering results should the objects as well as their widgets contain attributes named identically.
There is a precision limit when sorting string values: Only the first 50 characters of a string are guaranteed to be considered when sorting search results.
Params
attributeOrAttributes
(String or Array<String> | [String, 'asc' | 'desc']) – The attribute(s) by which the hits are to be sorted (e.g.'_path'
or['_objClass', 'title']
).
If more than one attribute is specified, the sort direction of each attribute can be set (e.g.[['_objClass', 'asc'], ['title', 'desc']]
). If no direction is specified for an attribute, the default isasc
. Up to five attributes are supported.direction
(optional) (String) – The direction in which the search results are to be ordered. Valid values areasc
anddesc
(ascending or descending). The default isasc
.
Returns
ObjSearch
– Itself