添加README

This commit is contained in:
xgc 2024-05-09 12:25:10 +08:00
parent 38d5963108
commit 48f2edbc23
2 changed files with 113 additions and 3 deletions

View File

@ -26,8 +26,8 @@ MilvusPlus 是一个功能强大的 Java 库,旨在简化与 Milvus 向量数
```xml
<dependency>
<groupId>io.github.javpower</groupId>
<artifactId>MilvusPlus</artifactId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>milvus-plus-boot-starter</artifactId>
<version>2.4.0</version>
</dependency>
```
@ -103,7 +103,7 @@ public static void main(String[] args) {
## 许可证
MilvusPlus 是开源的,遵循 [MIT 许可证](https://github.com/yourusername/MilvusPlus/blob/master/LICENSE)。
MilvusPlus 是开源的,遵循 [许可证](https://github.com/yourusername/MilvusPlus/blob/master/LICENSE)。
## 联系

110
README.md Normal file
View File

@ -0,0 +1,110 @@
# MilvusPlus: Enhanced Operations for Vector Databases
MilvusPlus is a powerful Java library that streamlines interactions with Milvus vector databases, offering an intuitive API for developers familiar with MyBatis-Plus style annotations and method invocations.
## Table of Contents
1. [Features](#features)
2. [Getting Started](#getting-started)
3. [Application Scenarios](#application-scenarios)
4. [Annotations](#annotations)
5. [Contributing](#contributing)
6. [License](#license)
## Features
- **Annotation-based Configuration**: Similar to MyBatis-Plus, use annotations to configure your entity models.
- **Intuitive API**: A straightforward API that makes vector database operations feel natural.
- **Extensible**: Designed with extensibility in mind, allowing for easy addition of new features.
- **Type-Safe**: Leverage Java's type safety to minimize errors.
## Getting Started
Add MilvusPlus to your project:
**Maven:**
```xml
<dependency>
<groupId>io.github.javpower</groupId>
<artifactId>milvus-plus-boot-starter</artifactId>
<version>2.4.0</version>
</dependency>
```
## Application Scenarios
Vector databases are particularly useful in:
- **Similarity Search**: Quickly find items most similar to a given vector.
- **Recommendation Systems**: Recommend content based on user behavior and preferences.
- **Image Retrieval**: Identify images most similar to a query image in a large database.
- **Natural Language Processing**: Perform semantic searches by converting text to vectors.
- **Bioinformatics**: Analyze and compare biological sequences like proteins and genomes.
## Annotations
MilvusPlus introduces several annotations to map your Java entities to Milvus collections:
- `@MilvusCollection`: Denotes a Java class as a Milvus collection.
- `@MilvusField`: Maps a Java field to a Milvus field with options for data type, dimension, and more.
- `@MilvusIndex`: Defines an index on a Milvus field.
Example usage:
```java
@Data
@MilvusCollection(name = "face_collection") // 指定Milvus集合的名称
public class Face {
@MilvusField(
name = "person_id", // 字段名称
dataType = DataType.Int64, // 数据类型为64位整数
isPrimaryKey = true, // 标记为主键
autoID = true // 假设这个ID是自动生成的
)
private Long personId; // 人员的唯一标识符
@MilvusField(
name = "face_vector", // 字段名称
dataType = DataType.FloatVector, // 数据类型为浮点型向量
dimension = 128, // 向量维度假设人脸特征向量的维度是128
isPartitionKey = false // 假设这个字段不是分区键
)
@MilvusIndex(
indexType = IndexParam.IndexType.IVF_FLAT, // 使用IVF_FLAT索引类型
metricType = IndexParam.MetricType.L2, // 使用L2距离度量类型
indexName = "face_index", // 索引名称
extraParams = { // 指定额外的索引参数
@ExtraParam(key = "nlist", value = "100") // 例如IVF的nlist参数
}
)
private List<Float> faceVector; // 存储人脸特征的向量
}
```
```
public static void main(String[] args) {
MilvusWrapper<Face> wrapper=new MilvusWrapper();
List<Float> vector = Lists.newArrayList(0.1f,0.2f,0.3f);
MilvusResp<Face> resp = wrapper.lambda()
.eq(Face::getPersonId,1l)
.addVector(vector)
.query();
}
```
## Contributing
Contributions are welcome!
- Report issues or suggest features by [opening an issue](https://github.com/yourusername/MilvusPlus/issues/new).
- Submit changes by [creating a pull request](https://github.com/yourusername/MilvusPlus/compare).
## License
MilvusPlus is open source and available under the [License](https://github.com/yourusername/MilvusPlus/blob/master/LICENSE).
## Contact
For questions or support, reach out to [javpower@163.com](mailto:javpower@163.com).