# MilvusPlus **Repository Path**: tearfive_admin/MilvusPlus ## Basic Information - **Project Name**: MilvusPlus - **Description**: 🔥🔥🔥使用MyBatisPlus的方式,优雅的操作向量数据库 Milvus - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: https://github.com/javpower/MilvusPlus - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 122 - **Created**: 2024-05-09 - **Last Updated**: 2024-05-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 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).