All Products
Search
Document Center

OpenSearch:SortField

Last Updated:Oct 10, 2023

Overview

This topic describes the SortField class and its methods. This class is used to configure sorting-related parameters.

Constructor

This constructor requires you to specify a field based on which documents are to be sorted, and a sorting method.
SortField(String field, Order order)

Parameter description

Parameter

Type

Description

field

String

The field based on which documents are to be sorted.

order

Order (enumeration type)

The sorting method. Valid values: Order.DECREASE and Order.INCREASE.


setField

Method definition

Specifies a field based on which documents are to be sorted.
SortField    setField(String field)

Parameter description

Parameter

Type

Description

field

String

The field based on which documents are to be sorted.


getField

Method definition

Obtains the specified field based on which documents are to be sorted.
String    getField()

Return value

  • The specified field based on which documents are to be sorted. Type: String.


setOrder

Method definition

Specifies a sorting method.
SortField    setOrder(Order order)

Parameter description

Parameter

Type

Description

order

Order (enumeration type)

The sorting method. Valid values: Order.DECREASE and Order.INCREASE.


getOrder

Method definition

Obtains the specified sorting method.
Order    getOrder()

Return value

  • The specified sorting method. Type: Order. Valid values: Order.DECREASE and Order.INCREASE.


Parameter description

For more information about the attributes of the Order enumeration class, see the "Order" topic.