All Products
Search
Document Center

:config clause

Last Updated:Aug 27, 2024

Overview

A config clause is an optional part of a query statement and is used to configure a query in real time. For example, you can use a config clause to specify the offset, the number of returned records, the format of the query results, and the timeout period of the query.

Syntax

{
  "config": {
  }
}

A config clause is optional and is specified as an object. For more information about the supported parameters, see Parameters.

Parameters

Parameter

Valid value

Default value

Parameter description

start

NUMBER

0

The offset value from which the system starts to return documents in the result set.

hit

NUMBER

10

The maximum number of documents in each result set.

format

'json' or 'xml'

'xml'

The format of the query results.

rank_trace

'FATAL' or 'ERROR' or 'INFO' or 'DEBUG' or 'WARN' or 'TRACE1' or 'TRACE2' or 'TRACE3'

None

The output information about the scoring process of a document in the frontend.

default_index

string

""

The default index that is used in the query. The default index is the same as the index that is specified in the query_config configuration item in the cluster configuration file. The index that you specify in a query is used as the default index. If you do not specify an index in the query, the index that is specified in the query_config configuration item is used.

default_operator

'AND' or 'OR'

""

The default operator that is used in the query. The default operator is the same as the operator that is specified in the query_config configuration item in the cluster configuration file. The operator that you specify in a query is used as the default operator. If you do not specify an operator in the query, the operator that is specified in the query_config configuration item is used.

timeout

NUMBER

0

The timeout period of the query. Unit: milliseconds. Default value: 0. The value cannot be negative.

seek_timeout

NUMBER

0

The timeout period of the query seeking phase. Unit: milliseconds. Default value: 0. By default, the specified timeout period multiplied by 0.7 is used as the seeking timeout period.

no_summary

no or yes

no

Specifies whether to query the summary. If this parameter is set to yes, only the first-phase query is run and the summary is not queried.

dedup

no or yes

yes

Specifies whether to remove duplicates from the result. If this parameter is set to yes, duplicates are automatically removed from the result based on the primary key. If this parameter is set to no, duplicates are not removed from the result.

searcher_return_hits

NUMBER

0

The number of records that are returned by the searcher. If this parameter is set to 0, the records are returned based on the values of the start and hit parameters. The value of the searcher_return_hits parameter cannot exceed 5000.

actual_hits_limit

NUMBER

0

Specifies whether the value of the totalhits parameter is an actual value or an estimated value. If the actual number of returned records is smaller than the value of the actual_hits_limit parameter, the actual value is returned. If the actual number of returned records is greater than the value of the actual_hits_limit parameter, the estimated value is returned. If this parameter is set to 0, the estimated value is always returned. If this parameter is set to numeric_limits<uint32_t>::max(), the actual value is always returned.

sourceid

string

None

The ID of the replica that is used for the query. Multiple replicas are available for indexes online. If you do not configure the sourceid parameter, a replica is randomly selected for each query. If an index is incrementally updated, the updated data may not be synchronized to all replicas. As a result, the most recent query result may not be returned. After the value of the sourceid parameter is specified, a replica is selected for the query based on the hash value of the sourceid parameter. In this case, the users who use the same value of the sourceid parameter can query the latest data. The value of the sourceid parameter is of the string type.

rerank_hint

BOOL

false

Specifies whether to perform the second scoring process for the query.

rank_size

NUMBER

0

The number of documents that are roughly sorted or the number of documents that are dynamically truncated based on the rank_size parameter. If this parameter is set to 0, the value in the configuration file is used.

rerank_size

NUMBER

0

The number of documents that are finely sorted in the first scoring process. If this parameter is set to 0, the value in the configuration file is used.

total_rank_size

NUMBER

0

The sum of documents that are roughly sorted in all partitions or the number of documents that are truncated based on a dynamic index. If this parameter is set to 0, the value in the configuration file is used.

total_rerank_size

NUMBER

0

The sum of documents that are finely sorted in the first scoring process of each partition. If this parameter is set to 0, the value in the configuration file is used.

fetch_summary_type

docid or pk or rawpk

docid

The method that is used to obtain the summary. By default, the summary is obtained based on docid. You can also specify to obtain the summary based on the hash value or the original value of the primary key. We recommend that you obtain the summary based on the hash value or the original value of the primary key.

research_threshold

NUMBER

0

Specifies the minimum number of records in the result. If the number of records is less than the value of this parameter, the query is performed again.

Examples

  1. Configure paging. In this example, 20 documents are returned on each page.

    # The config clause for the first page.
    {
      "config": {
        "start":0,
        "hit":20,
        "format":"xml"
      }
    } 
      
    # The config clause for the second page.
    {
      "config": {
        "start":1,
        "hit":20,
        "format":"xml"
      }
    }

  2. Set the number of documents to be sorted by a fine sort expression to 1000.

    {
      "config": {
        "start":1,
        "hit":20,
        "rerank_size":1000
      }
    }