Top searches and hints API

更新时间:
复制 MD 格式

Describes the API operations for querying model-recommended top searches and hints in OpenSearch.

Query top searches

Returns a list of model-recommended top searches.

HTTP 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 request headers and encoding details.

  • The sample URL also omits the endpoint of the OpenSearch application.

Request parameters

Parameter

Required

Type

Default value

Description

Remarks

app_name

Yes

string

The OpenSearch application name.

hit

No

int

10

The number of top searches to return.

Valid values: (0,30].

sort_type

No

string

default

The sort method. default: unsorted. pv: sorted by page views (PVs) in descending order. uv: sorted by unique visitors (UVs) who clicked the top searches in descending order. The uv option will be supported soon.

model_name

No

string

The model name for generating results.

Response parameters

Parameter

Required

Default value

Type

Description

request_id

Yes

string

The request ID.

result

Yes

array

The top searches list.

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

    Error codes.

Query hints

Returns a list of model-recommended hints.

HTTP 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 request headers and encoding details.

  • The sample URL also omits the endpoint of the OpenSearch application.

Request parameters

Parameter

Required

Type

Default value

Description

Remarks

app_name

Yes

string

The OpenSearch application name.

hit

No

int

3

The number of hints to return.

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

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

sort_type

No

string

default

The sort method. default: unsorted.

pv: sorted by PVs in descending order.

user_id

No

string

The user ID. Required for personalized hints.

If omitted or the specified user does not exist, general hints are returned.

model_name

No

string

The model name for generating results.

If omitted, the default model is used.

Response parameters

Parameter

Type

Description

data

object

The returned data.

data object

Parameter

Required

Default value

Type

Description

list

Yes

array

The list of hints.

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

    Error codes.