All Products
Search
Document Center

Query top searches and hints

Last Updated: Sep 09, 2021

Query top searches

Description

Note

You can call an API operation to query top searches. By default, the return results are a list of top searches that are recommended by a model.

Supported HTTP request method

Note

GET

URL

Note

/v3/openapi/apps/{app_name}/actions/hot?hit={hit}&sort_type={sort_type}&user_id={user_id}&model_name={model_name}

  • The sample URL omits information such as parameters in the request header and the encoding method.

  • The sample URL also omits the endpoint that is used to connect to OpenSearch.

Request parameters

Parameter

Required

Type

Default value

Description

Remarks

hit

No

Int

10

The number of top searches to be returned.

Valid values: (0, 30].

sort_type

No

String

default

The sorting method of the queried top searches. If this parameter is set to default, the top searches are not sorted. If this parameter is set to pv, the top searches are sorted based on the number of page views in descending order. If this parameter is set to uv, the top searches are sorted based on the number of unique visitors who have clicked the top searches in descending order.

user_id

No

String

The ID of the user who sent the current request. If you want to obtain personalized results, this parameter is required.

model_name

No

String

The name of the model based on which results are to be returned.

Response parameters

Parameter

Type

Description

data

Object

The result of the request.

Parameter description

Parameter

Required

Default value

Type

Description

list

Yes

Array

The list of queried top searches.

Example

Sample request

http://$host/v3/openapi/apps/{app_name}/actions/hot?hit={hit}&sort_type={sort_type}&user_id={user_id}&model_name={model_name}

Sample responses

Sample success response

{
   "request_id": "150116615820104116121674",
   "searchtime": 0.002654,
   "result": [
       {
           "hot": "连衣裙"
           "pv": 100000
       },
       {
           "hot": "连衣裙春装"
           "pv": 50000
       },
       {
           "hot": "连衣裙文艺"
           "pv": 10000
       }
   ]
}

Sample error response

For more information, see Error codes.

Query hints

Description

Note

You can call an API operation to query hints. By default, the return results are a list of hints that are recommended by a model.

Supported HTTP request method

Note

GET

URL

Note

/v3/openapi/apps/{app_name}/actions/hot?hit={hit}&sort_type={sort_type}&user_id={user_id}&model_name={model_name}

  • The sample URL omits information such as parameters in the request header and the encoding method.

  • The sample URL also omits the endpoint that is used to connect to OpenSearch.

Request parameters

Parameter

Required

Type

Default value

Description

Remarks

hit

No

Int

3

The number of hints to be returned.

Valid values: (0, 10].

sort_type

No

String

default

The sorting method of the queried hints. If this parameter is set to default, the hints are not sorted. If this parameter is set to pv, the hints are sorted based on the number of page views in descending order.

user_id

No

String

The ID of the user who sent the current request. If you want to obtain personalized results, this parameter is required.

model_name

No

String

The name of the model based on which results are to be returned.

Response parameters

Parameter

Type

Description

data

Object

The result of the request.

Parameter description

Parameter

Required

Default value

Type

Description

list

Yes

Array

The list of queried hints.

Example

Sample request

http://$host/v3/openapi/apps/{app_name}/actions/hot?hit={hit}&sort_type={sort_type}&user_id={user_id}&model_name={model_name}

Sample responses

Sample success response

{
   "request_id": "150116615820104116121674",
   "searchtime": 0.002654,
   "result": [
       {
           "hint": "连衣裙"
           "pv": 100000
       },
       {
           "hint": "连衣裙春装"
           "pv": 50000
       },
       {
           "hint": "连衣裙文艺"
           "pv": 10000
       }
   ]
}

Sample error response

For more information, see Error codes.