mirror of
https://gitee.com/dromara/MilvusPlus.git
synced 2025-12-06 17:08:27 +08:00
commit
863607ca37
@ -31,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>milvus-plus-core</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -41,7 +41,7 @@ Spring应用支持:
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>milvus-plus-boot-starter</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -51,7 +51,7 @@ Solon应用支持:
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>milvus-plus-solon-plugin</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ Custom extension support:
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>milvus-plus-core</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -37,7 +37,7 @@ Spring application support:
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>milvus-plus-boot-starter</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -47,7 +47,7 @@ Solon application support:
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>milvus-plus-solon-plugin</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
@ -20,9 +20,19 @@ public @interface MilvusCollection {
|
||||
String name();
|
||||
|
||||
/**
|
||||
*
|
||||
* 别名
|
||||
*/
|
||||
String[] alias() default {};
|
||||
|
||||
/**
|
||||
* 一致性级别
|
||||
*/
|
||||
|
||||
ConsistencyLevel level() default ConsistencyLevel.BOUNDED;
|
||||
|
||||
/**
|
||||
* 禁用动态字段
|
||||
*/
|
||||
boolean enableDynamicField() default false;
|
||||
|
||||
}
|
||||
@ -16,7 +16,14 @@ public class CollectionSchemaBuilder {
|
||||
private final MilvusClientV2 wrapper;
|
||||
private final CreateCollectionReq.CollectionSchema schema;
|
||||
private ConsistencyLevel consistencyLevel=ConsistencyLevel.BOUNDED;
|
||||
private Boolean enableDynamicField=false;
|
||||
|
||||
public CollectionSchemaBuilder(Boolean enableDynamicField,String collectionName, MilvusClientV2 wrapper) {
|
||||
this.collectionName = collectionName;
|
||||
this.wrapper = wrapper;
|
||||
this.schema = wrapper.createSchema();
|
||||
this.enableDynamicField=enableDynamicField;
|
||||
}
|
||||
public CollectionSchemaBuilder(String collectionName, MilvusClientV2 wrapper) {
|
||||
this.collectionName = collectionName;
|
||||
this.wrapper = wrapper;
|
||||
@ -44,7 +51,8 @@ public class CollectionSchemaBuilder {
|
||||
CreateCollectionReq req=CreateCollectionReq.builder().
|
||||
collectionName(this.collectionName).
|
||||
collectionSchema(this.schema).
|
||||
consistencyLevel(this.consistencyLevel)
|
||||
consistencyLevel(this.consistencyLevel).
|
||||
enableDynamicField(this.enableDynamicField)
|
||||
.build();
|
||||
wrapper.createCollection(req);
|
||||
}
|
||||
|
||||
@ -69,6 +69,8 @@ public class MilvusConverter {
|
||||
// 集合名称
|
||||
String collectionName = collectionAnnotation.name();
|
||||
milvus.setCollectionName(collectionName);
|
||||
boolean enableDynamicField = collectionAnnotation.enableDynamicField();
|
||||
milvus.setEnableDynamicField(enableDynamicField);
|
||||
//一致性级别
|
||||
ConsistencyLevel level = collectionAnnotation.level();
|
||||
milvus.setConsistencyLevel(level);
|
||||
@ -220,7 +222,7 @@ public class MilvusConverter {
|
||||
}
|
||||
// 创建新集合
|
||||
CollectionSchemaBuilder schemaBuilder = new CollectionSchemaBuilder(
|
||||
milvusEntity.getCollectionName(), client
|
||||
milvusEntity.getEnableDynamicField(),milvusEntity.getCollectionName(), client
|
||||
);
|
||||
schemaBuilder.addField(milvusEntity.getMilvusFields().toArray(new AddFieldReq[0]));
|
||||
schemaBuilder.addConsistencyLevel(milvusEntity.getConsistencyLevel());
|
||||
|
||||
@ -18,4 +18,5 @@ public class MilvusEntity {
|
||||
private List<AddFieldReq> milvusFields;
|
||||
private List<String> partitionName;
|
||||
private ConsistencyLevel consistencyLevel;
|
||||
private Boolean enableDynamicField;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
</developer>
|
||||
</developers>
|
||||
<properties>
|
||||
<revision>2.1.3</revision>
|
||||
<revision>2.1.4</revision>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<maven-compiler.version>3.11.0</maven-compiler.version>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user