From a65532c71cab17853d843fdd0f6f7ee234cb6f96 Mon Sep 17 00:00:00 2001 From: code2tan <495140477@qq.com> Date: Thu, 30 May 2024 10:16:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20MilvusIndex=E6=B3=A8=E8=A7=A3?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../milvus/plus/annotation/MilvusIndex.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusIndex.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusIndex.java index 8ed8f28..dd65b82 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusIndex.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusIndex.java @@ -7,14 +7,34 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; + /** * @author xgc **/ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface MilvusIndex { - IndexParam.IndexType indexType() default IndexParam.IndexType.FLAT; // 索引类型 - IndexParam.MetricType metricType() default IndexParam.MetricType.L2; // 度量类型 - String indexName() default ""; // 索引名称 - ExtraParam[] extraParams() default {}; // 指定额外的参数 + /** + * 索引类型 + * + * @see IndexParam.IndexType + */ + IndexParam.IndexType indexType() default IndexParam.IndexType.FLAT; + + /** + * 度量类型 + * + * @see IndexParam.MetricType + */ + IndexParam.MetricType metricType() default IndexParam.MetricType.L2; + + /** + * 索引名称 + */ + String indexName() default ""; + + /** + * 指定额外的参数 + */ + ExtraParam[] extraParams() default {}; } \ No newline at end of file From 1d95b6605325a72c9e355cf5f95e72ad1b55cf67 Mon Sep 17 00:00:00 2001 From: code2tan <495140477@qq.com> Date: Thu, 30 May 2024 10:29:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E4=BC=98=E5=8C=96annotation?= =?UTF-8?q?=E4=B8=8B=E6=89=80=E6=9C=89=E6=B3=A8=E8=A7=A3=E7=9A=84=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../milvus/plus/annotation/ExtraParam.java | 2 + .../plus/annotation/MilvusCollection.java | 6 +- .../milvus/plus/annotation/MilvusField.java | 64 ++++++++++++++++--- .../plus/annotation/MilvusPartition.java | 5 +- 4 files changed, 65 insertions(+), 12 deletions(-) diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/ExtraParam.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/ExtraParam.java index 61d9950..5dcab45 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/ExtraParam.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/ExtraParam.java @@ -4,6 +4,7 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; + /** * @author xgc **/ @@ -11,5 +12,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface ExtraParam { String key(); + String value(); } \ No newline at end of file diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusCollection.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusCollection.java index 50674fb..d206b54 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusCollection.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusCollection.java @@ -4,11 +4,15 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; + /** * @author xgc **/ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface MilvusCollection { - String name(); // 集合的名称 + /** + * 集合的名称 + */ + String name(); } \ No newline at end of file diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusField.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusField.java index 1e0b5aa..bbd4942 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusField.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusField.java @@ -6,6 +6,7 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; + /** * @author xgc **/ @@ -13,14 +14,57 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface MilvusField { - String name() default ""; // 字段名称,默认使用 Java 字段名 - DataType dataType() default DataType.FloatVector; // 数据类型,默认为 FLOAT_VECTOR - int dimension() default -1; // 向量维度,仅对向量类型有效 - boolean isPrimaryKey() default false; // 是否为主键 - boolean autoID() default false; // 是否自动生成 - String description() default ""; // 字段描述 - DataType elementType() default DataType.None; // 数组或集合中元素的类型,默认为 INVALID - int maxLength() default -1; // 数组或字符串类型的最大长度,默认为 -1(不指定) - int maxCapacity() default -1; // 集合类型的最大容量,默认为 -1(不指定) - boolean isPartitionKey() default false; // 是否为分区键 + /** + * 字段名称,默认使用 Java 字段名 + */ + String name() default ""; + + /** + * 数据类型,默认为 FLOAT_VECTOR + * + * @see DataType + */ + DataType dataType() default DataType.FloatVector; + + /** + * 向量维度,仅对向量类型有效 + */ + int dimension() default -1; + + /** + * 是否为主键 + */ + boolean isPrimaryKey() default false; + + /** + * 是否自动生成 + */ + boolean autoID() default false; + + /** + * 字段描述 + */ + String description() default ""; + + /** + * 数组或集合中元素的类型,默认为 INVALID + * + * @see DataType + */ + DataType elementType() default DataType.None; + + /** + * 数组或字符串类型的最大长度 + */ + int maxLength() default -1; + + /** + * 集合类型的最大容量 + */ + int maxCapacity() default -1; + + /** + * 是否为分区键 + */ + boolean isPartitionKey() default false; } \ No newline at end of file diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusPartition.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusPartition.java index b2d6c18..f684483 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusPartition.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/annotation/MilvusPartition.java @@ -11,5 +11,8 @@ import java.lang.annotation.Target; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface MilvusPartition { - String[] name(); // 分区的名称 + /** + * 分区的名称 + */ + String[] name(); } \ No newline at end of file