descending( )


Adds a sort to a search, sorting by the specified fields in descending order.

The descending() function refines a WixSearchBuilder to sort in descending order of the specified properties. If you specify more than one property, descending() sorts the results in descending order by each field in the order they are listed.

You can sort the following types:

  • Number: Sorts numerically.
  • Date: Sorts by date and time.
  • String: Sorts lexicographically, so "abc" comes before "XYZ".
  • Boolean: true comes after false.

If a property contains a number as a string, that value will be sorted alphabetically and not numerically. Documents that do not have a value for the specified sort property are ranked lowest.

Method Declaration
Copy
Method Parameters
fieldArray<string>Required

The fields used in the sort.

Returns
Return Type:WixSearchBuilder
Did this help?