Skip to content

Commit 97c76cd

Browse files
committed
feat(mol): add MOL data type, function, and PATTERN index
Signed-off-by: xiejh <862103595@qq.com>
1 parent 64c8e78 commit 97c76cd

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

sdk-core/src/main/java/io/milvus/common/clientenum/FunctionType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public enum FunctionType {
2323
UNKNOWN("Unknown", 0), // in milvus-proto, the name is "Unknown"
2424
BM25("BM25", 1), // Added missing name parameter
2525
TEXTEMBEDDING("TextEmbedding", 2), // in milvus-proto, the name is "TextEmbedding"
26-
RERANK("RERANK", 3); // Added missing name parameter
26+
RERANK("RERANK", 3), // Added missing name parameter
27+
MOL_FINGERPRINT("MolFingerprint", 5);
2728

2829
private final String name;
2930
private final int code;

sdk-core/src/main/java/io/milvus/param/IndexType.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public enum IndexType {
5050

5151
// Only for varchar type field
5252
TRIE("Trie", 100),
53+
// Only for geometry type field
54+
RTREE(120),
55+
// Only for mol type field
56+
PATTERN(121),
5357
// Only for scalar type field
5458
STL_SORT(200), // only for numeric type field
5559
INVERTED(201), // works for all scalar fields except JSON type field

sdk-core/src/main/java/io/milvus/param/ParamUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public static void checkFieldData(FieldType fieldSchema, List<?> values, boolean
270270
case String:
271271
case Geometry:
272272
case Timestamptz:
273+
case Mol:
273274
for (Object value : values) {
274275
if (checkNullableFieldData(fieldSchema, value, verifyElementType)) {
275276
continue;
@@ -423,6 +424,7 @@ public static Object checkFieldValue(String fieldName, DataType dataType, DataTy
423424
case String:
424425
case Geometry:
425426
case Timestamptz:
427+
case Mol:
426428
if (!(value.isJsonPrimitive())) {
427429
throw new ParamException(String.format(errMsgs.get(dataType), fieldName));
428430
}
@@ -1414,6 +1416,11 @@ public static ScalarField genScalarField(DataType dataType, DataType elementType
14141416
GeometryWktArray wktArray = GeometryWktArray.newBuilder().addAllData(strings).build();
14151417
return ScalarField.newBuilder().setGeometryWktData(wktArray).build();
14161418
}
1419+
case Mol: {
1420+
List<String> strings = objects.stream().map(p -> (p == null) ? null : (String) p).collect(Collectors.toList());
1421+
MolSmilesArray smilesArray = MolSmilesArray.newBuilder().addAllData(strings).build();
1422+
return ScalarField.newBuilder().setMolSmilesData(smilesArray).build();
1423+
}
14171424
case JSON: {
14181425
List<ByteString> byteStrings = objects.stream().map(p -> (p == null) ? null : ByteString.copyFromUtf8(p.toString()))
14191426
.collect(Collectors.toList());

sdk-core/src/main/java/io/milvus/v2/common/DataType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public enum DataType {
3838
JSON(23),
3939
Geometry(24),
4040
Timestamptz(26),
41+
Mol(27),
4142

4243
BinaryVector(100),
4344
FloatVector(101),

sdk-core/src/main/java/io/milvus/v2/common/IndexParam.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ public enum IndexType {
203203

204204
// Only for geometry type field
205205
RTREE(120),
206+
// Only for mol type field
207+
PATTERN(121),
206208

207209
// Only for scalar type field
208210
STL_SORT(200), // only for numeric type field

0 commit comments

Comments
 (0)