Retrieval configurations correspond to RecallConfs in the configuration overview.
How to configure
The PAI-Rec DPI engine has several built-in retrieval templates, such as collaborative filtering (UserCollaborativeFilterRecall), vector retrieval (HologresVectorRecall), and U2I retrieval (UserCustomRecall). It also supports multiple data sources, such as Hologres, PAI-FeatureStore, and TableStore (OTS).
Common retrieval configurations
Each retrieval configuration uses a set of common parameters. This section explains these common parameters, which are not repeated in the sections for individual retrieval methods.
Sample configuration:
{
"RecallConfs": [
{
"Name": "collaborative_filter",
"RecallType": "UserCollaborativeFilterRecall",
"RecallCount": 1000,
"RecallAlgo": "",
"ItemType": "",
"CacheAdapter": "",
"CacheConfig": "",
"CachePrefix": "",
"CacheTime": 0
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. You can reference this name in SceneConfs. |
RecallType | string | Yes | The built-in retrieval type of the DPI engine. This is an enumeration value. The following values are supported:
|
RecallCount | string | Yes | The number of items to retrieve. |
RecallAlgo | string | No | The name of the vector model to invoke. You must first configure the model in AlgoConfs. This parameter is used only for real-time vector retrieval. |
ItemType | string | No | The type of item to recommend. |
CacheAdapter | string | No | Caches the retrieval results. Enumeration values:
|
CacheConfig | string | No | Configurations for the cache. When you use Redis for caching, a sample configuration is "{\"host\":\"xxx.redis.rds.aliyuncs.com\", \"port\":6379,\"maxIdle\":10, \"password\":\"xxxx\"}". When you use localCache, a sample configuration is "{\"defaultExpiration\":600, \"cleanupInterval\":600}". |
CachePrefix | string | No | Adds a prefix to the key for the current retrieval result. This parameter is required when you enable caching. This prevents cache conflicts between different retrieval methods. For example, "group_hot_" indicates the cached result for a specific user in a group-based hot item retrieval. |
CacheTime | string | No | The cache duration in seconds. The default value is 1800. |
Collaborative filtering (UserCollaborativeFilterRecall)
Hologres
Collaborative filtering requires two tables: a u2i table to retrieve a list of items based on a user_id, and an i2i table to retrieve similar items. The schemas for these two tables have a fixed format.
In addition to retrieving similar items from an i2i table (u2i2i), you can also retrieve them indirectly from i2x and x2i tables (u2i2x2i). In this method, x represents an attribute such as category, brand, or city. The process first retrieves the x attribute of an item, such as the category field. Then, it retrieves popular items that have the corresponding x value from the x2i table to use as recommendations.
u2i table
Table field | Type | Description |
user_id | string | The user ID. The ID must be unique. |
item_ids | string | A list of item IDs that the user has browsed. Supported formats: item_id1,item_id2,item_id3... or item_id1:score1,item_id2:score2,item_id3:score3... |
i2i table (required only for u2i2i)
Table field | Type | Description |
item_id | string | The item ID. The ID must be unique. |
similar_item_ids | string | A list of items similar to the item_id. Supported format: item_id1:score1,item_id2:score2,item_id3:score3... |
i2x table (required only for u2i2x2i)
item_id | string | The item ID. The ID must be unique. |
x | string | An attribute of the item. You can customize the column name and specify the actual name in the DPI engine configuration. |
x2i table (required only for u2i2x2i)
x | string | An attribute of the item. You can customize the column name and specify the actual name in the DPI engine configuration. |
item_id | string | The item ID. Use commas (,) to separate multiple values. |
Sample u2i2i configuration:
{
"RecallConfs": [
{
"Name": "collaborative_filter",
"RecallType": "UserCollaborativeFilterRecall",
"RecallCount": 1000,
"UserCollaborativeDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"User2ItemTable": "u2i_table",
"Item2ItemTable": "i2i_table",
"Normalization": "on"
}
}
]
}Sample u2i2x2i configuration:
{
"RecallConfs": [
{
"Name": "collaborative_filter",
"RecallType": "UserCollaborativeFilterRecall",
"RecallCount": 1000,
"UserCollaborativeDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"User2ItemTable": "u2i_table",
"Item2XTable": "i2x_table",
"X2ItemTable": "x2i_table",
"XKey": "category",
"XDelimiter": ",",
"Normalization": "on"
}
}
]
}UserCollaborativeDaoConfig:
Field | Type | Required | Description |
AdapterType | string | Yes | A static field. Set the value to hologres. |
HologresName | string | Yes | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. |
User2ItemTable | string | Yes | The u2i table. |
Item2ItemTable | string | No | The i2i table. This parameter is required for the u2i2i method. |
Item2XTable | string | No | The i2x table. This parameter is required for the u2i2x2i method. |
X2ItemTable | string | No | The x2i table. This parameter is required for the u2i2x2i method. |
XKey | string | No | The x key. The value is the name of the x column in the i2x and x2i tables. This parameter is required for the u2i2x2i method. |
XDelimiter | string | No | The separator for x values. By default, x values are not split. |
Normalization | string | No | An enumeration value. Valid values: on, off. Specifies whether to normalize the retrieved items. The default value is "on". |
PAI-FeatureStore
Collaborative filtering requires two tables: a u2i table to retrieve a list of items based on a user_id, and an i2i table to retrieve similar items. The schemas for these two tables have a fixed format.
The data for both tables is generated in MaxCompute. You must register the data to Feature Store using an offline feature view. The schemas for the MaxCompute tables are as follows:
u2i table
Table field | Type | Description |
user_id | string | The user ID. The ID must be unique. |
item_ids | string | A list of item IDs that the user has browsed. Supported formats: item_id1,item_id2,item_id3... or item_id1:score1,item_id2:score2,item_id3:score3... |
ds | string | The partition field of the MaxCompute table. |
The following figure shows how to register the table to Feature Store:
i2i table
Table field | Type | Description |
item_id | string | The item ID. The ID must be unique. |
similar_item_ids | string | A list of items similar to the item_id. Supported format: item_id1:score1,item_id2:score2,item_id3:score3... |
dt | string | The partition field of the MaxCompute table. |
Sample configuration:
{
"RecallConfs": [
{
"Name": "collaborative_filter",
"RecallType": "UserCollaborativeFilterRecall",
"RecallCount": 1000,
"UserCollaborativeDaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"User2ItemFeatureViewName": "u2i_recall",
"Item2ItemFeatureViewName": "i2i_collaborative",
"Normalization": "on"
}
}
]
}UserCollaborativeDaoConfig:
Field | Type | Required | Description |
AdapterType | string | Yes | Static field: featurestore |
FeatureStoreName | string | Yes | The custom name of the Feature Store that is configured in the data source configuration (FeatureStoreConfs). For example, fs_pairec. |
User2ItemFeatureViewName | string | Yes | The name of the feature view that corresponds to the u2i table. |
Item2ItemFeatureViewName | string | Yes | The name of the feature view that corresponds to the i2i table. |
Normalization | string | No | An enumeration value. Valid values: on, off. Specifies whether to normalize the retrieved items. The default value is "on". |
TableStore (OTS)
Collaborative filtering requires two tables: a u2i table to retrieve a list of items based on a user_id, and an i2i table to retrieve similar items. The schemas for these two tables have a fixed format.
u2i table
Table field | Type | Description |
user_id | string | The user ID. The ID must be unique. |
item_ids | string | A list of item IDs that the user has browsed. Supported formats: item_id1,item_id2,item_id3... or item_id1:score1,item_id2:score2,item_id3:score3... |
i2i table
Table field | Type | Description |
item_id | string | The item ID. The ID must be unique. |
similar_item_ids | string | A list of items similar to the item_id. Supported format: item_id1:score1,item_id2:score2,item_id3:score3... |
{
"RecallConfs": [
{
"Name": "collaborative_filter",
"RecallType": "UserCollaborativeFilterRecall",
"RecallCount": 1000,
"UserCollaborativeDaoConf": {
"AdapterType": "tablestore",
"TableStoreName": "tablestore_info",
"User2ItemTable": "u2i_table",
"Item2ItemTable": "i2i_table",
"Normalization": "on"
}
}
]
}Field | Type | Required | Description |
AdapterType | string | Yes | A static field. Set the value to tablestore. |
TableStoreName | string | Yes | The custom name of the Table Store data source that is configured in the data source configuration (TableStoreConfs). For example, tablestore_info. |
User2ItemTable | string | Yes | The u2i table. |
Item2ItemTable | string | Yes | The i2i table. |
Normalization | string | No | An enumeration value. Valid values: on, off. Specifies whether to normalize the retrieved items. The default value is "on". |
Redis
The collaborative_filter process for Redis is unique and involves two steps:
Construct a key by concatenating RedisPrefix and the UID to query the U2I list. The key returns a string. The supported formats are item_id1,item_id2,item_id3... or item_id1:score1,item_id2:score2,item_id3:score3....
Query the I2I list. Use the MGET command to query based on the item_ids obtained in the previous step. The I2I data is also a string with the format item_id1:score1,item_id2:score2,item_id3:score3....
Sample configuration:
{
"RecallConfs": [
{
"Name": "collaborative_filter",
"RecallType": "UserCollaborativeFilterRecall",
"RecallCount": 1000,
"UserCollaborativeDaoConf": {
"AdapterType": "redis",
"RedisName": "redis_info",
"RedisPrefix": "cr_",
"Normalization": "on"
}
}
]
}Field | Type | Required | Description |
AdapterType | string | Yes | A static field. Set the value to redis. |
RedisName | string | Yes | The custom name of the Redis data source that is configured in the data source configuration (RedisConfs). For example, redis_info. |
RedisPrefix | string | No | The prefix for U2I data. The key is constructed by concatenating RedisPrefix and the UID. |
Only Redis is supported for data caching.
Real-time U2I2I (RealTimeU2IRecall)
Hologres
The data retrieval logic is the same as collaborative filtering, but the U2I data is calculated in real time from a user's historical behavior table.
The user's historical behavior table is updated in real time based on real-time logs, which enables real-time retrieval.
Similar to collaborative filtering, this method also supports u2i2x2i. It first retrieves the x attribute of an item and then retrieves other items with the same x attribute.
User historical behavior table
Field | Type | Description |
user_id | string | The user ID. |
item_id | string | The ID of the item browsed by the user. |
event | string | The event name. |
play_time | float | The duration of an event, such as a video view, cannot be set to 0. |
timestamp | int | The UNIX timestamp of the event occurrence, in seconds. |
i2i table (required only for u2i2i)
Table field | Type | Description |
item_id | string | The item ID. The ID must be unique. |
similar_item_ids | string | A list of items similar to the item_id. Supported format: item_id1:score1,item_id2:score2,item_id3:score3... |
i2x table (required only for u2i2x2i)
item_id | string | The item ID. The ID must be unique. |
x | string | An attribute of the item. You can customize the column name and specify the actual name in the DPI engine configuration. |
x2i table (required only for u2i2x2i)
x | string | An attribute of the item. You can customize the column name and specify the actual name in the DPI engine configuration. |
item_id | string | The item ID. Use commas (,) to separate multiple values. |
Behavior table creation statement:
BEGIN;
CREATE TABLE "sv_rec"."user_behavior_seq" (
"user_id" text NOT NULL,
"item_id" text NOT NULL,
"event" text NOT NULL,
"play_time" float8 NULL,
"timestamp" int8 NOT NULL
);
CALL SET_TABLE_PROPERTY('"sv_rec"."user_behavior_seq"', 'orientation', 'column');
call set_table_property('table_name', 'distribution_key', '"user_id"');
CALL SET_TABLE_PROPERTY('"sv_rec"."user_behavior_seq"', 'clustering_key', '"user_id:asc","timestamp:desc"');
CALL SET_TABLE_PROPERTY('"sv_rec"."user_behavior_seq"', 'bitmap_columns', '"user_id","event"');
CALL SET_TABLE_PROPERTY('"sv_rec"."user_behavior_seq"', 'dictionary_encoding_columns', '"user_id:auto","item_id:auto","event"');
CALL SET_TABLE_PROPERTY('"sv_rec"."user_behavior_seq"', 'time_to_live_in_seconds', '2592000');
comment on table "sv_rec"."user_behavior_seq" is 'Real-time user behavior sequence';
comment on column "sv_rec"."user_behavior_seq"."user_id" is 'User ID';
comment on column "sv_rec"."user_behavior_seq"."item_id" is 'Item ID';
comment on column "sv_rec"."user_behavior_seq"."event" is 'Event type';
comment on column "sv_rec"."user_behavior_seq"."play_time" is 'Reading duration, playback duration';
comment on column "sv_rec"."user_behavior_seq"."timestamp" is 'UNIX timestamp, in seconds';
COMMIT;Sample configuration:
{
"RecallConfs": [
{
"Name": "RealTimeEtrecRecall",
"RecallType": "RealTimeU2IRecall",
"RecallCount": 200,
"RealTimeUser2ItemDaoConf": {
"UserTriggerDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "user_behavior_table",
"WhereClause": "event='xxx'",
"Limit": 200,
"EventPlayTime": "playback:5000;playvslide:5000",
"EventWeight": "playback:1;playvslide:2",
"WeightExpression": "exp((-0.2)*((currentTime-eventTime)/3600/24))",
"WeightMode": "sum",
"NoUsePlayTimeField": false
},
"Item2ItemTable": "i2i_table",
"SimilarItemIdField": "similar_item_ids"
}
}
]
}Sample u2i2x2i configuration:
{
"RecallConfs": [
{
"Name": "RealTimeU2I2X2IRecall",
"RecallType": "RealTimeU2IRecall",
"RecallCount": 200,
"RealTimeUser2ItemDaoConf": {
"UserTriggerDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "user_behavior_table",
"WhereClause": "event='xxx'",
"Limit": 200,
"EventPlayTime": "playback:5000;playvslide:5000",
"EventWeight": "playback:1;playvslide:2",
"WeightExpression": "exp((-0.2)*((currentTime-eventTime)/3600/24))",
"WeightMode": "sum",
"NoUsePlayTimeField": false
},
"Item2XTable": "i2x_table",
"X2ItemTable": "x2i_table",
"XKey": "category",
"XDelimiter": ","
}
}
]
}RealTimeUser2ItemDaoConf:
Field | Type | Required | Description |
AdapterType | string | Yes | A static field. Set the value to hologres. |
HologresName | string | Yes | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. |
HologresTableName | string | Yes | The name of the user historical behavior table in Hologres. |
WhereClause | string | No | A filter condition, equivalent to the WHERE clause in SQL. |
Limit | int | No | The query limit, equivalent to the LIMIT clause in SQL. |
EventPlayTime | string | No | Filters events based on playback time. You can filter for each event. For example, e_sv_func_svplayback:5000 means that for the e_sv_func_svplayback event, the play_time value must be greater than 5000. Records that do not meet the condition are filtered out. You can set multiple events separated by semicolons (;). |
EventWeight | string | No | The weight of the event. You can define the weight for each event. If not set, the default value is 1. |
WeightExpression | string | No | A weight expression. Calculates the weight of an event based on time attenuation. currentTime represents the current UNIX timestamp, and eventTime represents the timestamp in the behavior table. |
WeightMode | string | No | The method to calculate the trigger weight. Valid values: sum, max. The default value is sum. |
NoUsePlayTimeField | bool | No | If you do not use the play_time field, set this to true. |
Item2ItemTable | string | No | The name of the i2i table in Hologres. This parameter is required for the u2i2i method. |
SimilarItemIdField | string | No | The field name in the i2i table in Hologres. The default value is similar_item_ids. |
Item2XTable | string | No | The name of the i2x table. This parameter is required for the u2i2x2i method. |
X2ItemTable | string | No | The name of the x2i table. This parameter is required for the u2i2x2i method. |
XKey | string | No | The x key. The value is the name of the x column in the i2x and x2i tables. This parameter is required for the u2i2x2i method. |
XDelimiter | string | No | The separator for x values. By default, x values are not split. |
PAI-FeatureStore
The data retrieval logic is the same as collaborative filtering, but the U2I data is calculated in real time from a user's historical behavior table.
The user's historical behavior table is updated in real time based on real-time logs, which enables real-time retrieval.
On the PAI-FeatureStore platform, you can use the behavior sequence type in a feature view to store user historical behavior data.
User historical behavior table
Field | Type | Description |
user_id | string | The user ID. |
item_id | string | The ID of the item browsed by the user. |
event | string | The event name. |
playtime | float | The duration of an event, such as a video view, cannot be set to 0. |
event_unix_time | int | The UNIX timestamp of the event occurrence, in seconds. |
i2i table
Table field | Type | Description |
item_id | string | The item ID. The ID must be unique. |
similar_item_ids | string | A list of items similar to the item_id. Supported format: item_id1:score1,item_id2:score2,item_id3:score3... |
Sample configuration:
{
"RecallConfs": [
{
"Name": "realtimeu2i",
"RecallType": "RealTimeU2IRecall",
"RecallCount": 200,
"RealTimeUser2ItemDaoConf": {
"UserTriggerDaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "user_behavior_table",
"TriggerCount": 100,
"EventWeight": "click:1;order:1",
"WeightExpression": "exp((-0.2)*((currentTime-eventTime)/3600/24))",
"WeightMode": "sum",
"NoUsePlayTimeField": false,
"ItemIdFieldName": "item_id",
"EventFieldName": "event",
"PlayTimeFieldName": "playtime",
"TimestampFieldName": "event_unix_time"
},
"Item2ItemFeatureViewName": "i2i_collaborative",
"SimilarItemIdField": "similar_item_ids"
}
}
]
}RealTimeUser2ItemDaoConf:
Field | Type | Required | Description |
UserTriggerDaoConf | |||
| string | Yes | Static Field: featurestore |
| string | Yes | The custom name of the Feature Store that is configured in the data source configuration (FeatureStoreConfs). For example, fs_pairec. |
| string | Yes | The name of the user historical behavior sequence view in Feature Store. |
| int | Yes | The number of user behavior triggers. |
| string | No | Filters events based on playback time. You can filter for each event. For example, e_sv_func_svplayback:5000 means that for the e_sv_func_svplayback event, the play_time value must be greater than 5000. Records that do not meet the condition are filtered out. You can set multiple events separated by semicolons (;). |
| string | Yes | The weight of the event. You can define the weight for each event. If not set, the default value is 1. Use a semicolon ( |
| string | Yes | A weight expression. Calculates the weight of an event based on time attenuation. currentTime represents the current UNIX timestamp, and eventTime represents the timestamp in the behavior table. |
| string | No | The method to calculate the trigger weight. Valid values: sum, max. The default value is sum. |
| bool | No | If you do not use the play_time field, set this to true. |
| string | No | The name of the item_id field in the user behavior sequence. The default value is item_id. |
| string | No | The name of the event field in the user behavior sequence. The default value is event. |
| string | No | The name of the playback time field in the user behavior sequence. The default value is play_time. |
| string | No | The name of the timestamp field in the user behavior sequence. The default value is timestamp. |
Item2ItemFeatureViewName | string | No | The name of the i2i table view in Feature Store. This parameter is required for the u2i2i method. |
SimilarItemIdField | string | No | The field name of the i2i table in Feature Store. The default value is similar_item_ids. |
MergeMode | string | No | Controls how to merge items retrieved by triggerId. By default, the retrieved items are merged, sorted, and deduplicated. Optional value: snake. This value merges the item lists retrieved by triggerId in a round-robin manner. |
I2ICacheSize | int | No | If this value is greater than 0, caching is enabled. The triggerId is used as the key, and the list of items retrieved from the i2i table is used as the value. |
I2ICacheTime | int | No | If caching is enabled, this parameter controls the cache duration in seconds. |
Vector retrieval (HologresVectorRecall)
Currently, vector retrieval supports only Hologres as a data source. All vector data is stored in Hologres tables.
Sample configuration:
{
"RecallConfs": [
{
"Name": "vector_recall",
"RecallType": "HologresVectorRecall",
"RecallCount": 100,
"VectorDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "user_embedding_table",
"KeyField": "user_id",
"EmbeddingField": "emb"
},
"HologresVectorConf": {
"VectorTable": "item_embedding_table",
"VectorEmbeddingField": "emb",
"VectorKeyField": "item_id"
}
}
]
}VectorDaoConf:
Field | Type | Required | Description |
AdapterType | string | Yes | The type of the data source. Set the value to hologres. |
HologresName | string | Yes | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. |
HologresTableName | string | Yes | The name of the corresponding vector table in Hologres. |
KeyField | string | Yes | The primary key field in the vector table. |
EmbeddingField | string | Yes | The field in the vector table that stores the vectors. |
HologresVectorConf:
Field | Type | Required | Description |
VectorTable | string | Yes | The item vector table in Hologres. |
VectorEmbeddingField | string | Yes | The primary key field in the item vector table. |
VectorKeyField | string | Yes | The field in the item vector table that stores the vectors. |
VectorDaoConf contains user vector information. The table is defined as follows:
BEGIN;
CREATE TABLE "public"."graphsage_user_embedding" (
"user_id" text NOT NULL,
"emb" float4[] NOT NULL,
"dt" text,
PRIMARY KEY ("user_id")
);
CALL SET_TABLE_PROPERTY('"public"."graphsage_user_embedding"', 'orientation', 'row');
CALL SET_TABLE_PROPERTY('"public"."graphsage_user_embedding"', 'clustering_key', '"user_id:asc"');
CALL SET_TABLE_PROPERTY('"public"."graphsage_user_embedding"', 'time_to_live_in_seconds', '3153600000');
comment on column "public"."graphsage_user_embedding"."user_id" is 'User ID';
comment on column "public"."graphsage_user_embedding"."emb" is 'User feature vector';
comment on column "public"."graphsage_user_embedding"."dt" is 'Date yyyyMMdd';
COMMIT;HologresVectorConf contains item vectors. The table is defined as follows:
BEGIN;
CREATE TABLE "public"."graphsage_item_embedding" (
"item_id" text NOT NULL,
"emb" float4[] NOT NULL,
PRIMARY KEY ("item_id")
);
CALL SET_TABLE_PROPERTY('"public"."graphsage_item_embedding"', 'orientation', 'column');
CALL SET_TABLE_PROPERTY('"public"."graphsage_item_embedding"', 'bitmap_columns', '"item_id"');
CALL SET_TABLE_PROPERTY('"public"."graphsage_item_embedding"', 'time_to_live_in_seconds', '3153600000');
comment on column "public"."graphsage_item_embedding"."item_id" is 'Item ID';
comment on column "public"."graphsage_item_embedding"."emb" is 'Item feature vector';
COMMIT;Real-time vector retrieval (OnlineHologresVectorRecall)
The implementation of real-time vector retrieval is similar to that of vector retrieval and is also based on Hologres table data. The difference is that the user vector is not retrieved from a table but is generated in real time by a model. The item vector table is then queried. The implementation process consists of three steps:
Retrieve user-related features. User features can be queried from a data table.
Call a vector model to obtain the user vector. In this implementation, the model is deployed on Elastic Algorithm Service (EAS).
Query the item vector table, which is similar to the process in vector retrieval.
Sample configuration:
{
"RecallConfs": [
{
"Name": "online_vector_recall",
"RecallType": "OnlineHologresVectorRecall",
"RecallCount": 500,
"UserFeatureConfs": [
{
"FeatureDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"FeatureKey": "user:uid",
"UserFeatureKeyName": "userid",
"HologresTableName": "user_all_feature_table",
"UserSelectFields": "*",
"FeatureStore": "user"
},
"Features": []
}
],
"RecallAlgo": "sv_v2_mind",
"HologresVectorConf": {
"HologresName": "holo_info",
"VectorTable": "item_embedding_table",
"VectorEmbeddingField": "item_emb",
"VectorKeyField": "item_id"
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to OnlineHologresVectorRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
RecallAlgo | string | Yes | The name of the vector model to invoke. You must configure the model in AlgoConfs. For more information about the configuration, see Fine-Grained Ranking configuration. |
UserFeatureConfs:
Field | Type | Required | Description |
AdapterType | string | Yes | The type of the data source. Set the value to hologres. |
HologresName | string | Yes | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. |
FeatureKey | string | Yes | The source of the user_id in the DPI engine. user:uid indicates the uid feature of the user. |
UserFeatureKeyName | string | Yes | The primary key field in the user feature table. |
HologresTableName | string | Yes | The user feature table. |
UserSelectFields | string | Yes | The features to select. You can use an asterisk (*) or a comma-separated list such as "f1,f2...". |
FeatureStore | string | Yes | The location where features are stored in the DPI engine. Enumeration values: user, item. |
HologresVectorConf:
Field | Type | Required | Description |
HologresName | string | Yes | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. |
VectorTable | string | Yes | The name of the item vector table in Hologres. |
VectorEmbeddingField | string | Yes | The field in the item vector table that stores the vectors. |
VectorKeyField | string | Yes | The primary key field in the item vector table. |
The sv_v2_mind model is defined in AlgoConfs as follows:
{
"AlgoConfs": [
{
"Name": "sv_v2_mind",
"Type": "EAS",
"EasConf": {
"Processor": "EasyRec",
"Timeout": 100,
"ResponseFuncName": "easyrecUserEmbResponseFunc",
"Url": "http://xxx.vpc.cn-beijing.pai-eas.aliyuncs.com/api/predict/sv_v2_mind",
"Auth": "xxx"
}
}
]
}The configuration is the same as that for a sorting model, but ResponseFuncName must be set to easyrecUserEmbResponseFunc.
U2I retrieval (UserCustomRecall)
Hologres
This method finds the corresponding item list based on the user ID. The table definition is based on a convention.
u2i table
Field | Type | Description |
user_id | string | The user ID. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
Sample configuration:
{
"RecallConfs": [
{
"Name": "user2item_recall",
"RecallType": "UserCustomRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "user_item_table"
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to UserCustomRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
DaoConf | json object | Yes | Definition of a DAO |
AdapterType | string | Yes | The data source type. Set the value to hologres. |
HologresName | string | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. | |
HologresTableName | string | Yes | The name of the data table. |
PAI-FeatureStore
This method finds the corresponding item list based on the user ID. The table definition is based on a convention.
The table data is generated in MaxCompute. You must register the data to Feature Store using an offline feature view. The MaxCompute table data schema is as follows:
u2i table
Field | Type | Description |
user_id | string | The user ID. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
ds | string | The partition field of the MaxCompute table. You can customize the name. |
Sample configuration:
{
"RecallConfs": [
{
"Name": "user2item_recall",
"RecallType": "UserCustomRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "u2i_recall"
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to UserCustomRecall. |
RecallCount | int | Yes | Recall count |
DaoConf | json object | Yes | The DAO definition. |
AdapterType | string | Yes | The data source type. Set the value to featurestore. |
FeatureStoreName | string | The custom name of the Hologres data source that is configured in the data source configuration (FeatureStoreConfs). For example, fs_pairec. | |
FeatureStoreViewName | string | Yes | The name of the view registered for the u2i table. |
TableStore (OTS)
This method finds the corresponding item list based on the user ID. The table definition is based on a convention.
u2i table
Field | Type | Description |
user_id | string | The user ID. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
Sample configuration:
{
"RecallConfs": [
{
"Name": "user2item_recall",
"RecallType": "UserCustomRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "tablestore",
"TableStoreName": "ots_info",
"TableStoreTableName": "user_item_table"
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to UserCustomRecall. |
RecallCount | int | Yes | Recall count |
DaoConf | json object | Yes | The DAO definition. |
AdapterType | string | Yes | The data source type. Set the value to tablestore. |
TableStoreName | string | The custom name of the Table Store data source that is configured in the data source configuration (TableStoreConfs). For example, tablestore_info. | |
TableStoreTableName | string | Yes | The name of the data table. |
Redis
Sample configuration:
{
"RecallConfs": [
{
"Name": "user2item_recall",
"RecallType": "UserCustomRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "redis",
"RedisName": "redis_info",
"RedisPrefix": ""
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to UserCustomRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
DaoConf | json object | Yes | The DAO definition. |
AdapterType | string | Yes | The data source type. Set the value to redis. |
RedisName | string | The custom name of the Redis data source that is configured in the data source configuration (RedisConfs). For example, redis_info. | |
RedisPrefix | string | Yes | The prefix for U2I data. The key is constructed by concatenating RedisPrefix and the UID. The value format is: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
Graph retrieval (GraphRecall)
Graph retrieval is a type of U2I retrieval that uses GraphCompute, a Graph Database.
Sample configuration:
{
"RecallConfs": [
{
"Name": "graph_recall",
"RecallType": "GraphRecall",
"RecallCount": 500,
"GraphConf": {
"GraphName": "graph_test",
"ItemId": "item_id",
"QueryString": "g(\"test\").V(\"$1\").hasLabel(\"user\").outE().inV()",
"Params": [
"user.uid"
]
}
}
]
}GraphConf:
Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to GraphRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
GraphName | string | Yes | The custom name of the graph that is configured in the data source configuration (GraphConfs). For example, graph_info. |
ItemId | string | Yes | The primary key field of the item in the graph result. |
QueryString | string | Yes | The search statement for graph retrieval. In the statement, $1 is a placeholder that takes its value from Params. |
Params | string | Yes | The source for filling parameters. The format is as follows:
|
User group hot item retrieval (UserGroupHotRecall)
Hologres
The table format for group hot item retrieval is based on a convention.
group_hot_table
Table field | Type | Description |
trigger_id | string | Trigger information, assembled from multiple features. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
You can assemble the trigger_id based on user features and context information, such as region and device model.
Concatenate the features in order with underscores (_) to form the trigger_id.
An empty feature value corresponds to NULL.
Features that include a Boundaries field require discretization into left-exclusive, right-inclusive intervals. For example, an age range of [20, 30, 40, 50] corresponds to triggers for <=20, 20-30, 30-40, 40-50, and >50.
A user age of 23 corresponds to "20-30".
A null user age corresponds to "NULL".
A user age of 60 corresponds to ">50".
A user age of 19 corresponds to "<=20".
Hologres table example:
This example uses three features: gender, age, and device model.
trigger_id | item_ids |
Male_<=20_IOS | item_id1::score1,item_id2::score2... |
Famale_20-30_Android | item_id4::score4,item_id5::score5... |
... | ... |
Sample configuration:
{
"RecallConfs": [
{
"Name": "user_group_hot_recall",
"RecallType": "UserGroupHotRecall",
"RecallCount": 500,
"Triggers": [
{
"TriggerKey": "gender"
},
{
"TriggerKey": "age",
"Boundaries": [20,30,40,50]
},
{
"TriggerKey": "os"
}
],
"DaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "group_hotness_table"
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to UserGroupHotRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
Triggers | json array | Yes | Specific information for constructing the trigger_id. |
| string | Yes | Gets the trigger value from the user's features. |
| json int array | No | The boundary value range for the field. |
DaoConf | json object | Yes | The DAO definition. |
| string | Yes | The data source type. Set the value to hologres. |
| string | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. | |
| string | Yes | The name of the data table. |
PAI-FeatureStore
The table format for group hot item retrieval is based on a convention.
The table data is generated in MaxCompute. You must register the data to Feature Store using an offline feature view. The MaxCompute table data schema is as follows:
group_hot_table
Table field | Type | Description |
trigger_id | string | Trigger information, assembled from multiple features. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
ds | string | The partition field of the MaxCompute table. You can customize this field. |
You can assemble the trigger_id based on user features and context information, such as region and device model.
Concatenate the features in order with underscores (_) to form the trigger_id.
An empty feature value corresponds to NULL.
Features that include a Boundaries field require discretization into left-exclusive, right-inclusive intervals. For example, an age range of [20, 30, 40, 50] corresponds to triggers for <=20, 20-30, 30-40, 40-50, and >50.
A user age of 23 corresponds to "20-30".
A null user age corresponds to "NULL".
A user age of 60 corresponds to ">50".
A user age of 19 corresponds to "<=20".
Table example:
This example uses three features: gender, age, and device model.
trigger_id | item_ids |
Male_<=20_IOS | item_id1::score1,item_id2::score2... |
Famale_20-30_Android | item_id4::score4,item_id5::score5... |
... | ... |
This process uses the trigger feature entity.
Sample configuration:
{
"RecallConfs": [
{
"Name": "user_group_hot_recall",
"RecallType": "UserGroupHotRecall",
"RecallCount": 500,
"Triggers": [
{
"TriggerKey": "gender"
},
{
"TriggerKey": "age",
"Boundaries": [20,30,40,50]
},
{
"TriggerKey": "os"
}
],
"DaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "group_hot_recall"
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to UserGroupHotRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
Triggers | json array | Yes | Specific information for constructing the trigger_id. |
| string | Yes | Gets the trigger value from the user's features. |
| json int array | No | The boundary value range for the field. |
DaoConf | json object | Yes | The DAO definition. |
| string | Yes | The data source type. Set the value to featurestore. |
| string | The custom name of the Hologres data source that is configured in the data source configuration (FeatureStoreConfs). For example, fs_pairec. | |
| string | Yes | The name of the feature view that corresponds to the hot item retrieval table. |
If user group hot item retrieval always returns 0 items, check the concatenation order of the Triggers. The DPI engine concatenates the triggers in the top-down order specified in the Triggers configuration. You must verify that this order matches the order in the retrieval table.
Global hot item retrieval (UserGlobalHotRecall)
Hologres
The table schema for global hot item retrieval is the same as the schema for group retrieval. The only difference is that the global hot item retrieval table contains only one record, and its trigger_id is -1.
Sample configuration:
{
"RecallConfs": [
{
"Name": "UserGlobalHotRecall",
"RecallType": "UserGlobalHotRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "global_hotness_table"
}
}
]
}PAI-FeatureStore
The table schema for global hot item retrieval is the same as the schema for group retrieval. The only difference is that the global hot item retrieval table contains only one record, and its trigger_id is -1.
The table data is generated in MaxCompute. You must register the data to Feature Store using an offline feature view. The MaxCompute table data schema is as follows:
Table field | Type | Description |
trigger_id | string | The table has only one row of data, and the value is -1. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
ds | string | The partition field of the MaxCompute table. You can customize this field. |
Sample configuration:
{
"RecallConfs": [
{
"Name": "UserGlobalHotRecall",
"RecallType": "UserGlobalHotRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "global_hot_recall"
}
}
]
}TableStore (OTS)
The table schema for global hot item retrieval is the same as the schema for group retrieval. The only difference is that the global hot item retrieval table contains only one record, and its trigger_id is -1.
Sample configuration:
{
"RecallConfs": [
{
"Name": "UserGlobalHotRecall",
"RecallType": "UserGlobalHotRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "tablestore",
"TableStoreName": "ots_info",
"TableStoreTableName": "global_hotness_recall"
}
}
]
}Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to UserGlobalHotRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
DaoConf | json object | Yes | The DAO definition. |
AdapterType | string | Yes | The data source type. Set the value to tablestore. |
TableStoreName | string | The custom name of the Table Store data source that is configured in the data source configuration (TableStoreConfs). For example, tablestore_info. | |
TableStoreTableName | string | Yes | The name of the data table. |
Cold start retrieval (ColdStartRecall)
This method provides an item material table and queries for a candidate set that meets specified rules by filtering based on conditions or time.
Hologres
{
"RecallConfs": [
{
"Name": "AllLiveItemRecall",
"RecallType": "ColdStartRecall",
"RecallCount": 3000,
"ColdStartDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "item_status_table",
"WhereClause": "islist_status=1",
"PrimaryKey": "\"item_id\"",
"TimeInterval": 0
}
}
]
}ColdStartDaoConf:
Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to ColdStartRecall. |
RecallCount | int | Yes | Recall Count |
ColdStartDaoConf | json object | Yes | The cold start data definition. |
AdapterType | string | Yes | The type of the data source, such as hologres. |
HologresName | string | Yes | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. |
HologresTableName | string | Yes | The name of the cold start retrieval table in Hologres. |
WhereClause | string | No | A filter condition. To filter by time, use ${time}. For example, to filter by creation time, use create_time > ${time}. |
PrimaryKey | string | Yes | The primary key of the table. |
TimeInterval | int | No | Calculates the ${time} value based on a time difference. ${time} = current time - TimeInterval |
In the preceding configuration, when you filter the candidate set using WhereClause, you can filter based on the features field passed in the API or the user's feature fields. For example, to filter the candidate set based on language and the user's city attribute, you can write the WhereClause as follows:
"language=${context.features.language} AND city=${user.city}"In this example, language can be passed in the features field of the API, and city is a user feature.
The source of the parameters is specified in the following format:
user.xxx represents the value of the xxx feature from the user's features.
context.features.xxx represents the value of the xxx feature from the features field in the API.
PAI-FeatureStore
Only feature views that use FeatureDB as the online store are supported.
Provide a feature view whose primary key is the item ID. A random batch of item IDs is retrieved from this view.
{
"RecallConfs": [
{
"Name": "item_cold_start_recall",
"RecallType": "ColdStartRecall",
"RecallCount": 200,
"ColdStartDaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "rec_sln_demo_item_table_preprocess_all_feature_v1"
},
"FilterParams": [
]
}
]
}The parameters are described as follows:
Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to ColdStartRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
ColdStartDaoConf | json object | Yes | The cold start data definition. |
AdapterType | string | Yes | The type of the data source. A static field. Set the value to featurestore. |
FeatureStoreName | string | Yes | The custom name of the Feature Store that is configured in the data source configuration (FeatureStoreConfs). |
FeatureStoreViewName | string | Yes | The name of the feature view for cold start retrieval. |
FilterParams | string | No | The filter conditions for cold start retrieval. |
The feature view specified for FeatureStoreViewName can be an offline or a real-time feature view. For a real-time view, this retrieval method obtains new item IDs in real time.
You can use the FilterParams parameter to filter for specific item IDs. If you leave this parameter empty, no filter conditions are set and item IDs are retrieved randomly.
{
"Name": "item_cold_start_recall",
"RecallType": "ColdStartRecall",
"RecallCount": 200,
"ColdStartDaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "rec_sln_demo_item_table_preprocess_all_feature_v1"
},
"FilterParams": [
{
"Name": "click_count",
"Type": "int",
"Operator": "greater",
"Value": "15"
},
{
"Name": "category",
"Type": "string",
"Operator": "in",
"Value": "user.category"
}
]
}In the preceding example, a Value prefixed with user. indicates that the value is retrieved from user features. These features, such as category, can be passed in the features field of the API.
For more information about the Operator, see the Appendix.
Context item retrieval (ContextItemRecall)
Sometimes, the retrieved items are passed through the DPI engine API. You can use item_list to pass custom retrieval data. For more information about the DPI engine API, see API test.
ContextItemRecall is a built-in retrieval name in the DPI engine that you can use directly in RecallNames. The following example shows a sample configuration:
{
"SceneConfs": {
"${scene_name}": {
"default": {
"RecallNames": [
"ContextItemRecall"
]
}
}
}
}I2I retrieval (ItemCollaborativeFilterRecall)
Hologres
I2I retrieval is used for similarity-based recommendations. For this type of recommendation, you must pass in the similar item_id. For more information about the specific API definition, see API test.
Sample configuration:
{
"RecallConfs": [
{
"Name": "I2IRecall",
"RecallType": "ItemCollaborativeFilterRecall",
"RecallCount": 500,
"ItemCollaborativeDaoConf": {
"AdapterType": "hologres",
"HologresName": "holo_info",
"Item2ItemTable": "item_collaborative_list"
}
}
]
}Configuration field descriptions:
Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to ItemCollaborativeFilterRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
ItemCollaborativeDaoConf | json object | Yes | The I2I table data definition. |
| string | Yes | The type of the data source. Set the value to hologres. |
| string | Yes | The custom name of the Hologres data source that is configured in the data source configuration (HologresConfs). For example, holo_info. |
| string | Yes | The name of the I2I data table. |
Definition of the Item2ItemTable table:
Field | Type | Description |
item_id | string | The item ID. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
PAI-FeatureStore
I2I retrieval is used for similarity-based recommendations. For this type of recommendation, you must pass in the similar item_id. For more information about the specific API definition, see API test.
Definition of the Item2ItemTable table:
Field | Type | Description |
item_id | string | The item ID. |
item_ids | string | A list of item IDs. Supported formats: item_id1,item_id2,item_id3... or item_id1:recall_id1,item_id2:recall_id2... or item_id1:recall_id1:score1,item_id2:recall_id2:score2... |
Sample configuration:
{
"RecallConfs": [
{
"Name": "I2IRecall",
"RecallType": "ItemCollaborativeFilterRecall",
"RecallCount": 200,
"ItemCollaborativeDaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "i2i_recall"
}
}
]
}Configuration field descriptions:
Field | Type | Required | Description |
Name | string | Yes | A custom name for the retrieval method. |
RecallType | string | Yes | The retrieval type. A static field. Set the value to ItemCollaborativeFilterRecall. |
RecallCount | int | Yes | The number of items to retrieve. |
ItemCollaborativeDaoConf | json object | Yes | The I2I table data definition. |
| string | Yes | The type of the data source. Set the value to featurestore. |
| string | Yes | The custom name that is configured in the data source configuration (FeatureStoreConfs). For example, fs_pairec. |
| string | Yes | The name of the I2I data table view. |
EnableMultipleItemId | bool | No | Specifies whether the passed item_id is in a multi-value format. |
MultipleItemIdDelimiter | string | No | When EnableMultipleItemId=true, this defines the separator for the item_id. The default value is a comma ( |
If the item_id passed to the interface is in a multi-value format and is separated by a comma (,), you can use the following configuration:
{
"RecallConfs": [
{
"Name": "I2IRecall",
"RecallType": "ItemCollaborativeFilterRecall",
"RecallCount": 200,
"ItemCollaborativeDaoConf": {
"AdapterType": "featurestore",
"FeatureStoreName": "fs_pairec",
"FeatureStoreViewName": "i2i_recall"
},
"EnableMultipleItemId": true,
"MultipleItemIdDelimiter": ","
}
]
}When you cache data using Redis or a localCache, the cache key is item_id.
For I2I retrieval, you must pass a value to the item_id field in the API request.
OpenSearch Recall (OpenSearchRecall)
This method directly calls the OpenSearch service to return a recall list. For more information about the OpenSearch documentation, see Introduction to the Industry Algorithm edition.
Configuration examples:
{
"RecallConfs": [
{
"Name": "OpenSearchRecall",
"RecallType": "OpenSearchRecall",
"OpenSearchConf": {
"OpenSearchName": "opensearch",
"AppName": "test_search",
"ItemId": "log_id",
"RequestParams": {
"query": "query=result:'$1'&&config=start:0,hit:10,format:fulljson&&sort=-log_id&&filter=request_time>1703952000000",
"format": "fulljson",
"second_rank_type": "expression",
"fetch_fields": "log_id;result_data"
},
"Params": [
"context.features.topic"
]
}
}
]
}The preceding example shows a query on the result index. The query term is obtained from the topic field of features in the interface context.
For OpenSearchConf, you can specify the following parameters:
Field | Type | Required | Description |
Name | string | Yes | Custom retrieval name. |
RecallType | string | Yes | Retrieval type. The value is fixed to OpenSearchRecall. |
RecallCount | int | Yes | Recall count |
OpenSearchName | string | Yes | The custom name for the OpenSearch instance. This name is configured in the data source configuration (OpenSearchConfs). |
AppName | string | Yes | The OpenSearch application name. |
ItemId | string | Yes | The primary key field for the item in the OpenSearch results. |
RequestParams | map[string]interface{} | Yes | The OpenSearch search statement. $1 is a placeholder that retrieves its value from Params. For more information about the syntax, see Developer Guide. |
Params | string | Yes | The source used to fill the parameters. The format is as follows:
|
Procedure
The SceneConfs parameter in the configuration overview specifies the retrieval scenarios. This parameter has a Map[string]object structure. The configuration is as follows:
"SceneConfs": {
"${scene_name}": {
"default": {
"RecallNames": [
"collaborative_filter"
]
}
}
}Replace ${scene_name} with your scenario name.
default is a folder. You can keep the default setting.
RecallNames is a []string. The value is the custom recall names in the recall configuration.