Config class

更新时间:
复制 MD 格式

Feature description

You can use the Config class to specify the offset of a result set, the number of results to return, the display format, and the number of documents to use in the fine sort expression. Note that the `rerank_size` parameter is set in the Rank class method.

Constructor (1)

// A constructor that specifies a list of application names when the object is created.
Config(List<String> appNames)

Parameters

Parameter name

Type

Description

appNames

List<String>

A list of application names.

Constructor (2)

// A constructor without parameters.
Config()

Set the offset of the result set (start)

API reference

// Sets the offset of the result set (start).
Config    setStart(int start)

Parameters

Parameter

Type

Required

Valid values

Default value

Description

start

int

No

[0, 5000]

0

Returns documents starting from the specified offset in the search results.


Retrieve the offset of the result set (start)

Interface definition

// Gets the offset of the result set (start).
int    getStart()

Return value

  • The value of the start parameter.


Set the number of documents in the result set (hit)

Interface Definition

// Sets the number of documents in the result set (hit).
Config    setHits(int hits)

Parameters

Parameter

Type

Required

Valid values

Default value

Description

hits

int

No

[0, 500]

10

The maximum number of documents to return.


Retrieve the number of documents in the result set (hit)

Interface Definition

// Gets the number of documents in the result set (hit).
int    getHits()

Return value

  • An integer that specifies the number of results to return.


Set the response data format (format)

Method definition

// Sets the data format of the returned results (format).
Config    setSearchFormat(SearchFormat.FULLJSON)

Parameters

Parameter

Type

Required

Valid values

Default value

Description

format

string

No

Valid values are xml, JSON, and fulljson.

JSON

The format of the returned documents. The fulljson format returns more nodes than the JSON format, such as variableValue.


Data format of the returned results (format)

Interface definition

// Gets the data format of the returned results (format).
SearchFormat    getSearchFormat()

Return value

  • An enumeration value from the SearchFormat type.


Specify the indexed fields to return (fetch_fields)

Interface Definition

// Sets the list of indexed fields to return (fetch_fields).
Config    setFetchFields(List<String> fetchFields)

Parameters

Parameter name

Type

Description

fetchFields

List<String>

The names of the fields to display.


Retrieve fields from search results (fetch_fields)

Interface definition

// Gets the list of fields included in the search results (fetch_fields).
List<String>    getFetchFields()

Return value

  • A list of strings that specifies the fields to display.


Set the current key-value pairs

Interface definition

// Sets the current kvpairs.
Config    setKvpairs(String kvpairs)

Parameters

Parameter name

Type

Description

kvpairs

String

The content of kvpairs.


Retrieve the current kvpairs

Interface definitions

// Gets the current kvpairs.
String    getKvpairs()

Return value

  • The content of the key-value pairs.


Setting the current routing value

Interface Definition

// Sets the current routing value.
Config    setRouteValue(String routeValue)

Parameters

Parameter name

Type

Description

routeValue

String

The value of the routing parameter.