The config clause specifies the starting position of query results, the number and format of returned results, and the number of documents that participate in fine ranking.
Syntax
|
Parameter |
Type |
Required |
Valid values |
Default value |
Description |
|
start |
int |
No |
[0, 5000] |
0 |
Return search results starting from the document specified by start. |
|
hit |
int |
No |
[0, 500] |
10 |
The maximum number of documents to return. |
|
format |
string |
No |
json |
The format of returned documents. Valid values are json and fulljson. Compared with json, fulljson includes additional fields, such as variableValue and sortExprValues. |
|
|
rerank_size |
int |
No |
[0, 2000] |
200 |
The number of documents from a single list that participate in fine ranking. |
|
total_rank_size |
int |
No |
- |
- |
The number of documents that participate in coarse ranking. |
|
default_operator |
string |
No |
'AND' or 'OR' |
AND |
The default query operator for this query. This parameter is supported only for dedicated instances. |
Notes
-
The config clause is optional.
-
Separate parameter pairs with commas (,).
-
Separate the key and value within a parameter pair with a colon (:).
-
The sum of start and hit cannot exceed 5,000. If it does, the query fails and returns no results. To paginate more than 5,000 documents, use the scroll method to batch export the documents, and then implement pagination in your application.
-
The default_operator parameter is supported only for dedicated instances.
-
Configure total_rank_size in the SDK as follows. Java SDK:
config.addToCustomConfig("total_rank_size:200000");. PHP SDK:$params->setCustomConfig('total_rank_size', 200000);. -
To view ranking details in code:
Add format:fulljson to the config clause.
In the response, sortExprValues contains the document score:
"sortExprValues": [ "10000.0399786383" ]sortExprValues is an array that contains the values of the fields in the sort clause. For example:
sort=-price;-RANKIn this example, sortExprValues contains [price, document score]. If sort is not specified, the value defaults to the document score.
Examples
-
Pagination: Retrieve 20 results per page. The following examples retrieve the first and second pages.
# First page config=start:0, hit:20, format:xml # Second page config=start:20, hit:20, format:xml -
Set the number of documents for fine ranking to 1,000.
config=start:0, hit:20, rerank_size:1000 -
Reduce the number of documents to retrieve.
config=start:0, hit:20, total_rank_size:100