فهرست منبع

Add missed index types (#317)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
groot 2 سال پیش
والد
کامیت
920d48e642

+ 8 - 0
src/main/java/io/milvus/client/AbstractMilvusGrpcClient.java

@@ -997,6 +997,14 @@ public abstract class AbstractMilvusGrpcClient implements MilvusClient {
                 extraParamList.forEach(createIndexRequestBuilder::addExtraParams);
             }
 
+            // keep consistence behavior with python sdk, if the index type is flat, return succeed with a warning
+            // TODO: call dropIndex if the index type is flat
+            // TODO: call describeCollection to check field name
+            if (requestParam.getIndexName() == "FLAT" || requestParam.getIndexName() == "BIN_FLAT") {
+                return R.success(new RpcStatus("Warning: It is not necessary to build index with index_type: FLAT"));
+            }
+
+            // keep consistence behavior with python sdk, flush before creating index
             FlushRequest flushRequest = FlushRequest.newBuilder()
                     .addCollectionNames(requestParam.getCollectionName())
                     .build();

+ 3 - 0
src/main/java/io/milvus/param/IndexType.java

@@ -25,15 +25,18 @@ package io.milvus.param;
  */
 public enum IndexType {
     INVALID,
+    FLAT,
     IVF_FLAT,
     IVF_PQ,
     IVF_SQ8,
+    IVF_HNSW,
     HNSW,
     RHNSW_FLAT,
     RHNSW_PQ,
     RHNSW_SQ,
     ANNOY,
     //Only supported for binary vectors
+    BIN_FLAT,
     BIN_IVF_FLAT,
     ;
 }

+ 2 - 2
src/main/java/io/milvus/param/index/CreateIndexParam.java

@@ -67,9 +67,9 @@ public class CreateIndexParam {
     public static final class Builder {
         private String collectionName;
         private String fieldName;
-        private IndexType indexType;
+        private IndexType indexType = IndexType.INVALID;
         private String indexName;
-        private MetricType metricType;
+        private MetricType metricType = MetricType.INVALID;
         private String extraParam;
 
         // syncMode: