All Products
Search
Document Center

OpenSearch:Config

Last Updated:Oct 10, 2023

Overview

The Config class is used for specify configurations such as the offset, number of documents to be returned, display format of return results, and number of documents to be sorted based on a fine sort expression.The rerank_size parameter in the Config class is set by the setReRankSize method of the Rank class.

Constructor (1)

This constructor requires you to specify a list of application names.
Config(List<String> appNames)

Parameter description

Parameter

Type

Description

appNames

List<String>

A list of application names.

Constructor (2)

This constructor requires no parameter.
Config()

setStart

Method definition

Specifies the offset of return results.
Config    setStart(int start)

Parameter description

Parameter

Type

Required

Valid values

Default value

Description

start

int

No

[0, 5000]

0

The ordinal number of the first document to be returned in search results.


getStart

Method definition

Obtains the specified offset of return results.
int    getStart()

Return value

  • The value of the start parameter in the setStart method.


setHits

Method definition

Specifies the maximum number of documents in each result set.
Config    setHits(int hits)

Parameter description

Parameter

Type

Required

Valid values

Default value

Description

hits

int

No

[0, 500]

10

The maximum number of documents in each result set.


getHits

Method definition

Obtains the specified maximum number of documents in each result set.
int    getHits()

Return value

  • The specified maximum number of documents in each result set. Type: int.


setSearchFormat

Method definition

Specifies the data format of return results.
Config    setSearchFormat(SearchFormat.FULLJSON)

Parameter description

Parameter

Type

Required

Valid values

Default value

Description

format

string

No

XML, JSON, and FULLJSON

JSON

The data format of return results. Supported formats include FULLJSON. Compared with the JSON format, the FULLJSON format supports extra fields such as variableValue.


getSearchFormat

Method definition

Obtains the specified data format of return results.
SearchFormat    getSearchFormat()

Return value

  • The specified data format of return results. Type: SearchFormat.


setFetchFields

Method definition

Specifies a list of index fields to be displayed in return results.
Config    setFetchFields(List<String> fetchFields)

Parameter description

Parameter

Type

Description

fetchFields

List<String>

The list of index fields to be displayed in return results.


getFetchFields

Method definition

Obtains the specified list of index fields to be displayed in return results.
List<String>    getFetchFields()

Return value

  • The specified list of index fields to be displayed in return results. Type: List<String>.


setKvpairs

Method definition

Specifies key-value pairs.
config    setKvpairs(String kvpairs)

Parameter description

Parameter

Type

Description

kvpairs

String

The key-value pairs.


getKvpairs

Method definition

Obtains the specified key-value pairs.
String    getKvpairs()

Return value

  • The specified key-value pairs. Type: String.


setRouteValue

Method definition

Specifies route parameter values.
Config    setRouteValue(String routeValue)

Parameter description

Parameter

Type

Description

routeValue

String

The route parameter values.