目录

aip_retrieval.h

Overview

Provides APIs related to knowledge retrieval.

File to include: #include "dataaugmentation/retrieval/aip_retrieval.h"

Library: libretrieval_ndk.so

System capability: SystemCapability.DataAugmentation.Retrieval

Since: 6.0.0(20)

Related module: Retrieval

Summary

[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.

[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) Reads the retrieval configuration to initialize the 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 to initialize the retriever.
int OH_Retrieval_DestroyConfig (OH_Retrieval_Config *config) Destroys the retriever 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.