@@ -1028,6 +1028,7 @@ void testStruct() {
10281028 String structField = "clips" ;
10291029 String structScalarField = "desc" ;
10301030 String structVectorField = "clip" ;
1031+ String structBinVectorField = "clip_bin" ;
10311032 int structCapacity = 300 ;
10321033 int varcharLength = 100 ;
10331034 CreateCollectionReq .CollectionSchema collectionSchema = CreateCollectionReq .CollectionSchema .builder ()
@@ -1065,6 +1066,12 @@ void testStruct() {
10651066 .dataType (DataType .FloatVector )
10661067 .dimension (DIMENSION )
10671068 .build ())
1069+ // .addStructField(AddFieldReq.builder()
1070+ // .fieldName(structBinVectorField)
1071+ // .description("dummy")
1072+ // .dataType(DataType.BinaryVector)
1073+ // .dimension(DIMENSION)
1074+ // .build())
10681075 .build ());
10691076
10701077 client .dropCollection (DropCollectionReq .builder ()
@@ -1084,10 +1091,17 @@ void testStruct() {
10841091 .metricType (IndexParam .MetricType .COSINE )
10851092 .build ());
10861093 indexParams .add (IndexParam .builder ()
1087- .fieldName (structVectorField )
1088- .indexType (IndexParam .IndexType .EMB_LIST_HNSW )
1089- .metricType (IndexParam .MetricType .MAX_SIM )
1090- .build ());
1094+ .fieldName ("clips[clip]" )
1095+ .indexName ("index1" )
1096+ .indexType (IndexParam .IndexType .HNSW )
1097+ .metricType (IndexParam .MetricType .MAX_SIM_L2 )
1098+ .build ());
1099+ // indexParams.add(IndexParam.builder()
1100+ // .fieldName("clips[clip_bin]")
1101+ // .indexName("index2")
1102+ // .indexType(IndexParam.IndexType.AUTOINDEX)
1103+ // .metricType(IndexParam.MetricType.MAX_SIM_HAMMING)
1104+ // .build());
10911105 client .createIndex (CreateIndexReq .builder ()
10921106 .collectionName (randomCollectionName )
10931107 .indexParams (indexParams )
@@ -1125,11 +1139,12 @@ void testStruct() {
11251139 DescribeIndexResp indexDesc = client .describeIndex (DescribeIndexReq .builder ()
11261140 .collectionName (randomCollectionName )
11271141 .fieldName (structVectorField )
1142+ .indexName ("index1" )
11281143 .build ());
11291144 Assertions .assertEquals (1 , indexDesc .getIndexDescriptions ().size ());
11301145 DescribeIndexResp .IndexDesc desc = indexDesc .getIndexDescriptions ().get (0 );
1131- Assertions .assertEquals (IndexParam .IndexType .EMB_LIST_HNSW , desc .getIndexType ());
1132- Assertions .assertEquals (IndexParam .MetricType .MAX_SIM , desc .getMetricType ());
1146+ Assertions .assertEquals (IndexParam .IndexType .HNSW , desc .getIndexType ());
1147+ Assertions .assertEquals (IndexParam .MetricType .MAX_SIM_L2 , desc .getMetricType ());
11331148
11341149 // insert
11351150 List <JsonObject > rows = new ArrayList <>();
@@ -1144,6 +1159,7 @@ void testStruct() {
11441159 JsonObject struct = new JsonObject ();
11451160 struct .addProperty (structScalarField , "No." + k );
11461161 struct .add (structVectorField , JsonUtils .toJsonTree (utils .generateFloatVector ()));
1162+ // struct.add(structBinVectorField, JsonUtils.toJsonTree(utils.generateBinaryVector(DIMENSION).array()));
11471163 structArr .add (struct );
11481164 }
11491165 row .add (structField , structArr );
@@ -1166,6 +1182,7 @@ void testStruct() {
11661182 JsonObject struct = new JsonObject ();
11671183 struct .addProperty (structScalarField , "updated_No." + k );
11681184 struct .add (structVectorField , JsonUtils .toJsonTree (utils .generateFloatVector ()));
1185+ // struct.add(structBinVectorField, JsonUtils.toJsonTree(utils.generateBinaryVector(DIMENSION).array()));
11691186 structArr .add (struct );
11701187 }
11711188 row .add (structField , structArr );
@@ -1190,25 +1207,25 @@ void testStruct() {
11901207 Assertions .assertTrue (queryResults .get (1 ).getEntity ().containsKey (structField ));
11911208
11921209 // search
1193- List <Map <String , Object >> structs0 = (List <Map <String , Object >>)queryResults .get (0 ).getEntity ().get (structField );
11941210 EmbeddingList embList0 = new EmbeddingList ();
1211+ EmbeddingList embList1 = new EmbeddingList ();
1212+
1213+ List <Map <String , Object >> structs0 = (List <Map <String , Object >>)queryResults .get (0 ).getEntity ().get (structField );
11951214 for (Map <String , Object > struct : structs0 ) {
11961215 embList0 .add (new FloatVec ((List <Float >)struct .get (structVectorField )));
11971216 }
1198-
11991217 List <Map <String , Object >> structs1 = (List <Map <String , Object >>)queryResults .get (1 ).getEntity ().get (structField );
1200- EmbeddingList embList1 = new EmbeddingList ();
12011218 for (Map <String , Object > struct : structs1 ) {
12021219 embList1 .add (new FloatVec ((List <Float >)struct .get (structVectorField )));
12031220 }
12041221
12051222 int topK = 5 ;
12061223 SearchResp searchResp = client .search (SearchReq .builder ()
12071224 .collectionName (randomCollectionName )
1208- .annsField (structVectorField )
1225+ .annsField ("clips[clip]" )
12091226 .data (Arrays .asList (embList0 , embList1 ))
12101227 .limit (topK )
1211- .outputFields (Collections .singletonList (structScalarField ))
1228+ .outputFields (Collections .singletonList ("clips[desc]" ))
12121229 .build ());
12131230 List <List <SearchResp .SearchResult >> searchResults = searchResp .getSearchResults ();
12141231 Assertions .assertEquals (2 , searchResults .size ());
0 commit comments