Skip to content

Commit 38fada7

Browse files
committed
Fix a bug that index property was not correctly passed
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent ce2c862 commit 38fada7

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

sdk-core/src/main/java/io/milvus/v2/service/index/IndexService.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,12 @@ public Void createIndex(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub
6666
}
6767
Map<String, Object> extraParams = indexParam.getExtraParams();
6868
if (extraParams != null && !extraParams.isEmpty()) {
69-
JsonObject params = new JsonObject();
7069
for (String key : extraParams.keySet()) {
71-
params.addProperty(key, extraParams.get(key).toString());
70+
builder.addExtraParams(KeyValuePair.newBuilder()
71+
.setKey(key)
72+
.setValue(extraParams.get(key).toString())
73+
.build());
7274
}
73-
// the extra params is a JSON format string like "{\"M\": 8, \"efConstruction\": 64}"
74-
builder.addExtraParams(KeyValuePair.newBuilder()
75-
.setKey(Constant.PARAMS)
76-
.setValue(params.toString())
77-
.build());
7875
}
7976

8077
Status status = blockingStub.createIndex(builder.build());

sdk-core/src/main/java/io/milvus/v2/utils/ConvertUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ public DescribeIndexResp convertToDescribeIndexResp(List<IndexDescription> respo
9999
} else if (param.getKey().equals(Constant.MMAP_ENABLED)) {
100100
properties.put(param.getKey(), param.getValue());
101101
} else if (param.getKey().equals(Constant.PARAMS)) {
102-
extraParams = JsonUtils.fromJson(param.getValue(), new TypeToken<Map<String, String>>() {}.getType());
102+
Map<String, String> tempParams = JsonUtils.fromJson(param.getValue(), new TypeToken<Map<String, String>>() {}.getType());
103+
tempParams.remove(Constant.MMAP_ENABLED);
104+
extraParams.putAll(tempParams);
105+
} else {
106+
extraParams.put(param.getKey(), param.getValue());
103107
}
104108
}
105109

0 commit comments

Comments
 (0)