From 48f2edbc230b9fb23279031fe5eeec867e011ca6 Mon Sep 17 00:00:00 2001 From: xgc Date: Thu, 9 May 2024 12:25:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.cn.md | 6 +-- README.md | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/README.cn.md b/README.cn.md index 422fb3c..1863ada 100644 --- a/README.cn.md +++ b/README.cn.md @@ -26,8 +26,8 @@ MilvusPlus 是一个功能强大的 Java 库,旨在简化与 Milvus 向量数 ```xml io.github.javpower - MilvusPlus - 0.0.1-SNAPSHOT + milvus-plus-boot-starter + 2.4.0 ``` @@ -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)。 ## 联系 diff --git a/README.md b/README.md new file mode 100644 index 0000000..5571796 --- /dev/null +++ b/README.md @@ -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 + + io.github.javpower + milvus-plus-boot-starter + 2.4.0 + +``` + +## 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 faceVector; // 存储人脸特征的向量 +} +``` +``` +public static void main(String[] args) { + MilvusWrapper wrapper=new MilvusWrapper(); + List vector = Lists.newArrayList(0.1f,0.2f,0.3f); + MilvusResp 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).