All Products
Search
Document Center

OpenSearch:Rank class

Last Updated:Oct 19, 2026

Overview

This topic describes the methods of the Rank class, which is used to configure sort expressions and the rerank_size parameter.

Constructor

No-argument constructor
Rank()

Set the name of the rough sort expression

Method definition

Sets the name of the rough sort expression.
Rank    setFirstRankName(String firstRankName)

Parameters

Parameter

Type

Description

firstRankName

String

The name of the rough sort expression.

Get the name of the rough sort expression

Method definition

Gets the name of the rough sort expression.
String    getFirstRankName()

Return value

  • String: the name of the rough sort expression.

Set the name of the fine sort expression

Method definition

Sets the name of the fine sort expression.
Rank    setSecondRankName(String secondRankName)

Parameters

Parameter

Type

Description

secondRankName

String

The name of the fine sort expression.

Set the type of the sort expression

Method definition

Sets the type of the sort expression.
Rank setSecondRankType(RankType secondRankType)

Parameters

Parameter

Type

Description

secondRankType

RankType

The type of the sort expression (enumeration). Valid values:

  • EXPRESSION (default): policy-based sorting.

  • CAVA_SCRIPT: Cava script.

Get the name of the fine sort expression

Method definition

Gets the name of the fine sort expression.
String    getSecondRankName()

Return value

  • String: the name of the fine sort expression.

Set the number of documents involved in fine sort

Method definition

Sets the number of documents involved in fine sort. This parameter corresponds to the rerank_size parameter in the config clause.
Rank    setReRankSize(int reRankSize)

Parameters

Parameter

Type

Required

Valid values

Default value

Description

rerank_size

int

No

[0, 2000]

200

The number of documents involved in fine sort.

Get the number of documents involved in fine sort

Method definition

Gets the number of documents involved in fine sort.
int    getReRankSize()

Return value

  • int: the number of documents involved in fine sort.