目录

Retrieval

Overview

The ArkData Intelligence Platform (AIP) provides apps with the capabilities of vectorization, knowledge retrieval, and knowledge Q&A, and helps build on-device intelligent solutions.

Since: 6.0.0(20)

Summary

[h2]File

Name Description
aip_retrieval.h Provides APIs related to knowledge retrieval.
aip_retrieval_condition.h Provides APIs related to retrieval conditions.
aip_retrieval_condition_vector.h Provides APIs related to vector conditions.
aip_retrieval_query.h Provides APIs related to retrieval queries.
aip_retrieval_record.h Provides APIs related to retrieval results.

[h2]Types

Name Description
typedef struct OH_Retrieval_Retriever OH_Retrieval_Retriever Defines a retriever type. The retriever serves as the handle for performing retrieval operations.
typedef struct OH_Retrieval_Config OH_Retrieval_Config Defines a retriever configuration.
typedef struct OH_Retrieval_DbConfig OH_Retrieval_DbConfig Defines a database configuration.
typedef enum Retrieval_Channel_Type Retrieval_Channel_Type Defines an enum of data index types. Currently, only the vector index type is supported.
typedef void(* OH_Retrieval_Callback) (void *context, OH_Retrieval_Record *record, int errCode) Defines the callback function for returning a retrieval result.
typedef struct OH_Retrieval_Condition OH_Retrieval_Condition Defines the retrieval condition, which can contain multiple sub-conditions.
typedef struct OH_Retrieval_SubCondition OH_Retrieval_SubCondition Defines a retrieval sub-condition, which can be used for vector retrieval.
typedef struct OH_Retrieval_SubCondition OH_Retrieval_VectorCondition Defines a vector retrieval condition, including the retrieval parameters and filter conditions.
typedef struct OH_Retrieval_Query OH_Retrieval_Query Defines a retrieval keyword. Currently, only plaintext retrieval is supported.
typedef struct OH_Retrieval_Record OH_Retrieval_Record Defines the retrieval result, including the fields returned from the knowledge base and their values.
typedef struct OH_Retrieval_RecordItem OH_Retrieval_RecordItem Defines the database bucket array in the retrieval result.

[h2]Enums

Name Description
Retrieval_Channel_Type { RETRIEVAL_TYPE_VECTOR = 1 } Defines an enum of data index types. Currently, only the vector index type is supported.

[h2]Functions

Name Description
int OH_Retrieval_CreateRetriever (const OH_Retrieval_Config *config, OH_Retrieval_Retriever **retriever) Obtains a retriever.
int OH_Retrieval_DestroyRetriever (OH_Retrieval_Retriever *retriever) Destroys the retriever obtained through OH_Retrieval_CreateRetriever.
OH_Retrieval_Config * OH_Retrieval_CreateConfig () Obtains the retriever configuration
int OH_Retrieval_DestroyConfig (OH_Retrieval_Config *config) Destroys the retrieval configuration obtained through OH_Retrieval_CreateConfig.
OH_Retrieval_DbConfig * OH_Retrieval_CreateDbConfig () Creates a configuration to open the database.
int OH_Retrieval_DestroyDbConfig (OH_Retrieval_DbConfig *dbConfig) Destroys the OH_Retrieval_DbConfig created by OH_Retrieval_CreateDbConfig.
int OH_Retrieval_SetDbConfig (OH_Retrieval_DbConfig *dbConfig, OH_Rdb_ConfigV2*rdbConfig) Sets the database configuration in OH_Retrieval_DbConfig.
int OH_Retrieval_AddConfig (OH_Retrieval_Config *config, Retrieval_Channel_Type channelType, OH_Retrieval_DbConfig *dbConfig) Sets the database configuration in OH_Retrieval_Config.
int OH_Retrieval_Retrieve (const OH_Retrieval_Retriever *retriever, const OH_Retrieval_Query *query, const OH_Retrieval_Condition *condition, void *context, const OH_Retrieval_Callback *callback) Performs retrieval. After obtaining the retriever handle, input the retrieval keyword and perform retrieval based on the retrieval condition to obtain the retrieval result.
OH_Retrieval_Condition * OH_Retrieval_CreateCondition () Creates a retrieval condition as the input parameter of the retrieval API.
int OH_Retrieval_DestroyCondition (OH_Retrieval_Condition *condition) Destroys the retrieval condition obtained through OH_Retrieval_CreateCondition.
int OH_Retrieval_DestroySubCondition (OH_Retrieval_SubCondition *condition) Destroys the OH_Retrieval_SubCondition object.
int OH_Retrieval_AddSubCondition (OH_Retrieval_Condition *condition, OH_Retrieval_SubCondition *subCondition) Adds a sub-condition to a retrieval condition.
OH_Retrieval_VectorCondition * OH_Retrieval_CreateVectorCondition () Creates a vector retrieval condition.
int OH_Retrieval_DestroyVectorCondition (OH_Retrieval_VectorCondition *condition) Destroys the retrieval condition obtained through OH_Retrieval_CreateVectorCondition.
int OH_Retrieval_SetVectorRecallLimit (OH_Retrieval_VectorCondition *condition, uint32_t limit) Sets a maximum of 1000 results for vector retrieval within a retrieval condition.
int OH_Retrieval_SetSimilarityThreshold (OH_Retrieval_VectorCondition *condition, double threshold) Sets the similarity threshold of vector retrieval in a retrieval condition.
OH_Retrieval_Query * OH_Retrieval_CreateQuery () Creates a retrieval keyword as the input parameter of the retrieval API.
int OH_Retrieval_DestroyQuery (OH_Retrieval_Query *query) Destroys the retrieval keyword obtained through OH_Retrieval_CreateQuery.
int OH_Retrieval_SetOriginalQuestion (OH_Retrieval_Query *query, const char *question) Sets retrieval keywords in OH_Retrieval_Query.
int OH_Retrieval_DestroyRecord (OH_Retrieval_Record *record) Destroys the retrieval result obtained through the retrieval API OH_Retrieval_Retrieve.
int OH_Retrieval_GetRecordLength (const OH_Retrieval_Record *record, uint32_t *length) Obtains the length of the database bucket array in the retrieval result OH_Retrieval_Record.
int OH_Retrieval_GetRecordItem (const OH_Retrieval_Record *record, uint32_t index, const OH_Retrieval_RecordItem **item) Obtains the database bucket array in the retrieval result OH_Retrieval_Record.
int OH_Retrieval_GetItemSize (const OH_Retrieval_RecordItem *items, const char *fieldName, size_t *size) Obtains the size of the value of a specified field in the database bucket array OH_Retrieval_RecordItem. The size value contains the null terminator.
int OH_Retrieval_GetItemText (const OH_Retrieval_RecordItem *items, const char *fieldName, char *value, size_t size) Obtains the value of a specified field in the database bucket array OH_Retrieval_RecordItem.

Type Description

[h2]OH_Retrieval_Callback

typedef void (*OH_Retrieval_Callback)(void *context, OH_Retrieval_Record *record, int errCode)

Description

Defines the callback function for returning a retrieval result.

Since: 6.0.0(20)

Parameters:

Name Description
context Context data provided by a user.
record Pointer to the OH_Retrieval_Record instance.
errCode Returned error code.

[h2]OH_Retrieval_Condition

typedef struct OH_Retrieval_Condition OH_Retrieval_Condition

Description

Defines the retrieval condition, which can contain multiple sub-conditions.

Since: 6.0.0(20)

[h2]OH_Retrieval_Config

typedef struct OH_Retrieval_Config OH_Retrieval_Config

Description

Defines retrieval configurations, including the database path, database name, and package name.

Since: 6.0.0(20)

[h2]OH_Retrieval_DbConfig

typedef struct OH_Retrieval_DbConfig OH_Retrieval_DbConfig

Description

Defines a database configuration.

Since: 6.0.0(20)

[h2]OH_Retrieval_Query

typedef struct OH_Retrieval_Query OH_Retrieval_Query

Description

Defines a retrieval keyword. Currently, only plaintext retrieval is supported. Images, videos, and other formats are not supported.

Since: 6.0.0(20)

[h2]OH_Retrieval_Record

typedef struct OH_Retrieval_Record OH_Retrieval_Record

Description

Defines the retrieval result, including the fields returned from the knowledge base and their values.

Since: 6.0.0(20)

[h2]OH_Retrieval_RecordItem

typedef struct OH_Retrieval_RecordItem OH_Retrieval_RecordItem

Description

Defines the database bucket array in the retrieval result.

Since: 6.0.0(20)

[h2]OH_Retrieval_Retriever

typedef struct OH_Retrieval_Retriever OH_Retrieval_Retriever

Description

Defines a retriever type. The retriever serves as the handle for performing retrieval operations.

Since: 6.0.0(20)

[h2]OH_Retrieval_SubCondition

typedef struct OH_Retrieval_SubCondition OH_Retrieval_SubCondition

Description

Defines sub-conditions for retrieval. Currently, only vector retrieval is supported.

Since: 6.0.0(20)

[h2]OH_Retrieval_VectorCondition

typedef struct OH_Retrieval_SubCondition OH_Retrieval_VectorCondition

Description

Defines a vector retrieval condition, including the retrieval parameters and filter conditions.

Since: 6.0.0(20)

[h2]Retrieval_Channel_Type

typedef enum Retrieval_Channel_Type Retrieval_Channel_Type

Description

Defines an enum of data index types. Currently, only the vector index type is supported.

Since: 6.0.0(20)

Enumeration Description

[h2]Retrieval_Channel_Type

enum Retrieval_Channel_Type

Description

Defines an enum of data index types. Currently, only the vector index type is supported.

Since: 6.0.0(20)

Value Description
RETRIEVAL_TYPE_VECTOR Vector index. The corresponding value is 1.

Function Description

[h2]OH_Retrieval_AddConfig()

int OH_Retrieval_AddConfig(OH_Retrieval_Config *config, Retrieval_Channel_Type channelType, OH_Retrieval_DbConfig *dbConfig)

Description

Sets the database configuration in OH_Retrieval_Config.

Since: 6.0.0(20)

Parameters:

Name Description
config Pointer to the OH_Retrieval_Config instance.
channelType Data index type. Currently, only vector retrieval is supported.
dbConfig Pointer to the database configuration instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Config, Retrieval_Channel_Type, OH_Retrieval_DbConfig, and OH_Aip_ErrCode

[h2]OH_Retrieval_AddSubCondition()

int OH_Retrieval_AddSubCondition(OH_Retrieval_Condition *condition, OH_Retrieval_SubCondition *subCondition)

Description

Adds a sub-condition to a retrieval condition. Currently, only one sub-condition can be added.

Since: 6.0.0(20)

Parameters:

Name Description
condition Pointer to the OH_Retrieval_Condition instance.
subCondition Pointer to the instance of a sub-condition, which can be a vector retrieval condition OH_Retrieval_VectorCondition.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200009 The number of conditions exceeds the maximum (1).
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Condition, OH_Retrieval_SubCondition, OH_Retrieval_VectorCondition, and OH_Aip_ErrCode

[h2]OH_Retrieval_CreateCondition()

OH_Retrieval_Condition *OH_Retrieval_CreateCondition()

Description

Creates a retrieval condition as the input parameter of the retrieval API.

Since: 6.0.0(20)

Returns:

If the function is successfully executed, a pointer to the OH_Retrieval_Condition instance is returned. If the function fails to be executed, the pointer is null.

For details, see:

OH_Retrieval_Condition

[h2]OH_Retrieval_CreateConfig()

OH_Retrieval_Config *OH_Retrieval_CreateConfig()

Description

Obtains the retriever configuration to initialize the retriever.

Since: 6.0.0(20)

Returns:

If the function is successfully executed, a pointer to the OH_Retrieval_Config instance is returned. If the function fails to be executed, the pointer is null.

For details, see:

OH_Retrieval_Config, and OH_Aip_ErrCode

[h2]OH_Retrieval_CreateDbConfig()

OH_Retrieval_DbConfig *OH_Retrieval_CreateDbConfig()

Description

Creates a database configuration.

Since: 6.0.0(20)

Returns:

Pointer to the OH_Retrieval_DbConfig instance. If the function fails to be executed, the pointer is null.

For details, see:

OH_Retrieval_DbConfig and OH_Aip_ErrCode

[h2]OH_Retrieval_CreateQuery()

OH_Retrieval_Query *OH_Retrieval_CreateQuery()

Description

Creates a retrieval keyword as the input parameter of the retrieval API.

Since: 6.0.0(20)

Returns:

If the function is successfully executed, a pointer to the OH_Retrieval_Query instance is returned. If the function fails to be executed, the pointer is null.

For details, see:

OH_Retrieval_Query

[h2]OH_Retrieval_CreateRetriever()

int OH_Retrieval_CreateRetriever(const OH_Retrieval_Config *config, OH_Retrieval_Retriever **retriever)

Description

Reads the retrieval configuration to initialize the retriever.

Since: 6.0.0(20)

Parameters:

Name Description
config Retriever configuration item OH_Retrieval_Config, which needs to be input to the retriever during its creation.
retriever Pointer to the OH_Retrieval_Retriever instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Retriever, OH_Retrieval_Config, and OH_Aip_ErrCode

[h2]OH_Retrieval_CreateVectorCondition()

OH_Retrieval_VectorCondition *OH_Retrieval_CreateVectorCondition()

Description

Creates a vector retrieval condition.

Since: 6.0.0(20)

Returns:

If the function is successfully executed, a pointer to the OH_Retrieval_VectorCondition instance is returned. If the function fails to be executed, the pointer is null.

For details, see:

OH_Retrieval_VectorCondition

[h2]OH_Retrieval_DestroyCondition()

int OH_Retrieval_DestroyCondition(OH_Retrieval_Condition *condition)

Description

Destroys the retrieval condition obtained through OH_Retrieval_CreateCondition.

Since: 6.0.0(20)

Parameters:

Name Description
condition Pointer to the OH_Retrieval_Condition instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Condition, OH_Aip_ErrCode, and OH_Retrieval_CreateCondition

[h2]OH_Retrieval_DestroyConfig()

int OH_Retrieval_DestroyConfig(OH_Retrieval_Config *config)

Description

Destroys the retrieval configuration obtained through OH_Retriever_CreateConfig.

Since: 6.0.0(20)

Parameters:

Name Description
config Pointer to the OH_Retrieval_Config instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Config, OH_Aip_ErrCode, and OH_Retrieval_CreateConfig

[h2]OH_Retrieval_DestroyDbConfig()

int OH_Retrieval_DestroyDbConfig(OH_Retrieval_DbConfig *dbConfig)

Description

Destroys the OH_Retrieval_DbConfig created by OH_Retrieval_CreateDbConfig.

Since: 6.0.0(20)

Parameters:

Name Description
dbConfig Pointer to the OH_Retrieval_DbConfig instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_DbConfig, OH_Aip_ErrCode, and OH_Retrieval_CreateDbConfig

[h2]OH_Retrieval_DestroyQuery()

int OH_Retrieval_DestroyQuery(OH_Retrieval_Query *query)

Description

Destroys the retrieval keyword obtained through OH_Retrieval_CreateQuery.

Since: 6.0.0(20)

Parameters:

Name Description
query Pointer to the OH_Retrieval_Query instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Query, OH_Aip_ErrCode, and OH_Retrieval_CreateQuery

[h2]OH_Retrieval_DestroyRecord()

int OH_Retrieval_DestroyRecord(OH_Retrieval_Record *record)

Description

Destroys the retrieval result obtained through the retrieval API OH_Retrieval_Retrieve.

Since: 6.0.0(20)

Parameters:

Name Description
record Pointer to the OH_Retrieval_Record instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Record, OH_Aip_ErrCode, and OH_Retrieval_Retrieve

[h2]OH_Retrieval_DestroyRetriever()

int OH_Retrieval_DestroyRetriever(OH_Retrieval_Retriever *retriever)

Description

Destroys the retriever obtained through OH_Retrieval_CreateRetriever.

Since: 6.0.0(20)

Parameters:

Name Description
retriever Pointer to the OH_Retrieval_Retriever instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Retriever, OH_Aip_ErrCode, and OH_Retrieval_CreateRetriever

[h2]OH_Retrieval_DestroySubCondition()

int OH_Retrieval_DestroySubCondition(OH_Retrieval_SubCondition *condition)

Description

Destroy the OH_Retrieval_SubCondition object.

Since: 6.0.0(20)

Parameters:

Name Description
condition Pointer to the OH_Retrieval_SubCondition instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_SubCondition, and OH_Aip_ErrCode

[h2]OH_Retrieval_DestroyVectorCondition()

int OH_Retrieval_DestroyVectorCondition(OH_Retrieval_VectorCondition *condition)

Description

Destroys the retrieval condition obtained through OH_Retrieval_CreateVectorCondition.

Since: 6.0.0(20)

Parameters:

Name Description
condition Pointer to the vector retrieval condition OH_Retrieval_VectorCondition.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_VectorCondition, OH_Aip_ErrCode, and OH_Retrieval_CreateVectorCondition

[h2]OH_Retrieval_GetItemSize()

int OH_Retrieval_GetItemSize(const OH_Retrieval_RecordItem *items, const char *fieldName, size_t *size)

Description

Obtains the size of the value of a specified field in the database bucket array OH_Retrieval_RecordItem. The size value contains the null terminator.

Since: 6.0.0(20)

Parameters:

Name Description
items Pointer to the database bucket array OH_Retrieval_RecordItem instance.
fieldName Name of the database bucket field.
size Size of the value of a database bucket field.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200007 The field does not exist.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_RecordItem, and OH_Aip_ErrCode

[h2]OH_Retrieval_GetItemText()

int OH_Retrieval_GetItemText(const OH_Retrieval_RecordItem *items, const char *fieldName, char *value, size_t size)

Description

Obtains the value of a specified field in the database bucket array OH_Retrieval_RecordItem.

Since: 6.0.0(20)

Parameters:

Name Description
items Pointer to the database bucket array OH_Retrieval_RecordItem instance.
fieldName Name of the database bucket field.
value Value of the database bucket field.
size Size of the value of a database bucket field.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200007 The field does not exist.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_RecordItem, and OH_Aip_ErrCode

[h2]OH_Retrieval_GetRecordItem()

int OH_Retrieval_GetRecordItem(const OH_Retrieval_Record *record, uint32_t index, const OH_Retrieval_RecordItem **item)

Description

Obtains the database bucket array in the retrieval result OH_Retrieval_Record.

Since: 6.0.0(20)

Parameters:

Name Description
record Pointer to the OH_Retrieval_Record instance.
index Index value of the record array. The maximum value is 999.
item Pointer to a single element OH_Retrieval_RecordItem in the record array.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200006 The index number exceeds the allowed range.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Record, OH_Retrieval_RecordItem, and OH_Aip_ErrCode

[h2]OH_Retrieval_GetRecordLength()

int OH_Retrieval_GetRecordLength(const OH_Retrieval_Record *record, uint32_t *length)

Description

Obtains the database bucket array in the retrieval result OH_Retrieval_Record.

Since: 6.0.0(20)

Parameters:

Name Description
record Pointer to the OH_Retrieval_Record instance.
length Length of the database bucket array.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Record and OH_Aip_ErrCode

[h2]OH_Retrieval_Retrieve()

int OH_Retrieval_Retrieve(const OH_Retrieval_Retriever *retriever, const OH_Retrieval_Query *query, const OH_Retrieval_Condition *condition, void *context, const OH_Retrieval_Callback *callback)

Description

Performs retrieval. After obtaining the retriever handle, input the retrieval keyword and perform retrieval based on the retrieval condition to obtain the retrieval result. During the API call, temporary cache files are generated under the path /data/storage/el2/base/cache. For phones or tablets, this API supports inverted indexing only and does not support vector retrieval. Before the callback is triggered, do not destroy the memory of the input parameter pointer. Otherwise, the program may be abnormal.

Since: 6.0.0(20)

Parameters:

Name Description
retriever Retriever handle, which is a pointer to the OH_Retrieval_Retriever instance.
query Query word for retrieval, which is a pointer to the OH_Retrieval_Query instance.
condition Retrieval condition, which is a pointer to the OH_Retrieval_Condition instance.
context Context data provided by a user. The data will be passed back to the function during subsequent calls.
callback Pointer to the OH_Retrieval_Callback instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200005 An execution error occurred.
1021200010 Invalid parameter.
1021200012 Failed to generate an embedding vector.

For details, see:

OH_Retrieval_Retriever, OH_Retrieval_Query, OH_Retrieval_Condition, OH_Retrieval_Callback, and OH_Aip_ErrCode

[h2]OH_Retrieval_SetDbConfig()

int OH_Retrieval_SetDbConfig(OH_Retrieval_DbConfig *dbConfig, OH_Rdb_ConfigV2 *rdbConfig)

Description

Sets the database configuration in OH_Retrieval_DbConfig.

Since: 6.0.0(20)

Parameters:

Name Description
dbConfig Pointer to the OH_Retrieval_DbConfig instance.
rdbConfig Pointer to the database configuration instance, which may be the OH_Rdb_ConfigV2 instance.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_DbConfig, OH_Rdb_ConfigV2, OH_Aip_ErrCode

[h2]OH_Retrieval_SetOriginalQuestion()

int OH_Retrieval_SetOriginalQuestion(OH_Retrieval_Query *query, const char *question)

Description

Sets retrieval keywords in OH_Retrieval_Query.

Since: 6.0.0(20)

Parameters:

Name Description
query Pointer to the OH_Retrieval_Query instance.
question Query in plaintext.

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200008 The array length exceeds 512 bytes.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_Query and OH_Aip_ErrCode

[h2]OH_Retrieval_SetSimilarityThreshold()

int OH_Retrieval_SetSimilarityThreshold(OH_Retrieval_VectorCondition *condition, double threshold)

Description

Sets the similarity threshold of vector retrieval in a retrieval condition.

Since: 6.0.0(20)

Parameters:

Name Description
condition Pointer to the OH_Retrieval_VectorCondition instance.
threshold Cosine similarity threshold of vector retrieval. The value range is [0, 1].

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_VectorCondition and OH_Aip_ErrCode

[h2]OH_Retrieval_SetVectorRecallLimit()

int OH_Retrieval_SetVectorRecallLimit(OH_Retrieval_VectorCondition *condition, uint32_t limit)

Description

Sets the maximum number of vector retrieval results in the retrieval conditions.

Since: 6.0.0(20)

Parameters:

Name Description
condition Pointer to the OH_Retrieval_VectorCondition instance.
limit Maximum number of vector retrieval results. The value range is [1, 1000].

Returns:

Execution status of the function. AIP_OK will be returned if the function is successfully executed.

ID Error Message
0 Operation successful.
1021200010 Invalid parameter.

For details, see:

OH_Retrieval_VectorCondition and OH_Aip_ErrCode