Vector indexing (Java SDK V2)
This topic describes how to perform vector retrieval by using MetaQuery in OSS Java SDK V2.
How it works
Vector retrieval helps you quickly locate target objects among large numbers of objects based on semantic content, OSS metadata, multimedia metadata, object ETags, tags, and custom metadata. Vector retrieval also relies on the MetaQuery metadata index library. Before you start, enable metadata management in semantic mode.
Prerequisites
OSS Java SDK V2 is installed. If you use Maven, add the following dependency to the pom.xml file:
com.aliyun:alibabacloud-oss-v2.Access credentials are configured by using environment variables. The examples in this topic use
EnvironmentVariableCredentialsProviderto read credentials from theOSS_ACCESS_KEY_IDandOSS_ACCESS_KEY_SECRETenvironment variables.
Permissions
By default, an Alibaba Cloud account has full permissions. RAM users and RAM roles have no permissions by default. The Alibaba Cloud account owner or an administrator must grant the required permissions.
API | Actions | Description |
OpenMetaQuery |
| Enables metadata management. |
GetMetaQueryStatus |
| Obtains metadata index information. |
DoMetaQuery |
| Queries objects that meet specified conditions. |
CloseMetaQuery |
| Disables metadata management. |
Sample code
References
For API details about enabling metadata management, see OpenMetaQuery.
For API details about obtaining metadata index information, see GetMetaQueryStatus.
For API details about vector retrieval, see DoMetaQuery.
For API details about disabling metadata management, see CloseMetaQuery.
For the synchronous sample code, see OpenMetaQuery.java.
For the synchronous sample code, see DoMetaQuery.java.
For the synchronous sample code, see CloseMetaQuery.java.