All Products
Search
Document Center

OpenSearch:Sort

Last Updated:Oct 10, 2023

Overview

This topic describes the Sort class and its methods.

Constructor (1)

This constructor requires you to specify a list of fields based on which documents are to be sorted.
Sort(List<SortField> sortFields)

Parameter description

Parameter

Type

Description

sortFields

List<SortField>

The list of fields based on which documents are to be sorted.

Constructor (2)

This constructor requires no parameter.
Sort()

addToSortFields

Method definition

Adds a field based on which documents are to be sorted.
void    addToSortFields(SortField elem)

Parameter description

Parameter

Type

Description

elem

SortField

The field based on which documents are to be sorted.


setSortFields

Method definition

Specifies a list of fields based on which documents are to be sorted.
Sort    setSortFields(List<sortField> sortFields)

Parameter description

Parameter

Type

Description

sortFields

List<SortField>

The list of fields based on which documents are to be sorted.


getSortFields

Method definition

Obtains the specified list of fields based on which documents are to be sorted.
List<sortField>    getSortFields()

Return value

  • The specified list of fields based on which documents are to be sorted. Type: List<SortField>.


getSortFieldsSize

Method definition

Obtains the number of fields based on which documents are to be sorted.
int    getSortFieldsSize()

Return value

  • The number of fields based on which documents are to be sorted. Type: int.


Methods of the SortField class

For more information, see the "SortField" topic.