All Products
Search
Document Center

OpenSearch:Query top searches and hints

Last Updated:Nov 30, 2023

Query a list of top searches

Description

Queries a list of top searches. By default, the returned results are a list of top searches that are recommended by a model.

Supported HTTP request method

GET

URL

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

Note

  • The sample URL omits information such as request headers and the encoding method.

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

Request parameters

Parameter

Required

Type

Default value

Description

Remarks

app_name

Yes

string

The name of the OpenSearch application.

hit

No

int

10

The number of top searches to be queried.

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 (PVs) in descending order. If this parameter is set to uv, the top searches are sorted based on the number of unique visitors (UVs) who clicked the top searches in descending order. The uv option will be supported soon.

model_name

No

string

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

Response parameters

Parameter

Required

Default value

Type

Description

request_id

Yes

string

The request ID.

result

Yes

array

The queried top searches.

Sample requests

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

Sample responses

Sample success response

{
   "request_id": "150116615820104116121674",
   "searchtime": 0.002654,
   "result": [
       {
           "hot": "One-piece dress", // The top search.
           "pv": 100000,    // The number of requests collected during the training period. By default, the system collects the number of requests within 14 days for a regular model.
         	 "tags":0         // The tag returned by the real-time top search model. A value of 0 indicates new. A value of 1 indicates hot. A value of 2 indicates viral.
       },
       {
           "hot": "One-piece dress for spring",
           "pv": 50000
       },
       {
           "hot": "One-piece dress for art enthusiasts",
           "pv": 10000
       }
   ]
}

Sample error response

For more information, see Error codes.

Query a list of hints

Description

Queries a list of hints. By default, the returned results are a list of hints that are recommended by a model.

Supported HTTP request method

GET

URL

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

  • The sample URL omits information such as request headers and the encoding method.

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

Request parameters

Parameter

Required

Type

Default value

Description

Remarks

app_name

Yes

string

The name of the OpenSearch application.

hit

No

int

3

The number of hints to be queried.

Valid values for general hints: (0,10].

Valid values for personalized hints :(0,30].

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 PVs in descending order.

user_id

No

string

The ID of the user who sends the request. This parameter is required to query personalized hints.

If you do not specify this parameter or the specified user does not exist, general hints are queried.

model_name

No

string

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

If you do not specify this parameter, the default model is used.

Response parameters

Parameter

Type

Description

data

object

The query results.

Parameter description

Parameter

Required

Default value

Type

Description

list

Yes

array

The list of queried hints.

Examples

Sample requests

http://$host/v3/openapi/apps/{app_name}/actions/hint?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": "One-piece dress",
           "pv": 100000
       },
       {
           "hint": "One-piece dress for spring",
           "pv": 50000
       },
       {
           "hint": "One-piece dress for art enthusiasts",
           "pv": 10000
       }
   ]
}

Sample error response

For more information, see Error codes.