|
@@ -42,7 +42,7 @@ public class MilvusClientExample {
|
|
|
return vectors;
|
|
|
}
|
|
|
|
|
|
- // Helper function that normalizes a vector if you are using IP (Inner product) as your metric
|
|
|
+ // Helper function that normalizes a vector if you are using IP (Inner Product) as your metric
|
|
|
// type
|
|
|
static List<Float> normalizeVector(List<Float> vector) {
|
|
|
float squareSum = vector.stream().map(x -> x * x).reduce((float) 0, Float::sum);
|
|
@@ -77,7 +77,7 @@ public class MilvusClientExample {
|
|
|
final String tableName = "example"; // table name
|
|
|
final long dimension = 128; // dimension of each vector
|
|
|
final long indexFileSize = 1024; // maximum size (in MB) of each index file
|
|
|
- final MetricType metricType = MetricType.IP; // we choose IP (Inner project) as our metric type
|
|
|
+ final MetricType metricType = MetricType.IP; // we choose IP (Inner Product) as our metric type
|
|
|
TableSchema tableSchema =
|
|
|
new TableSchema.Builder(tableName, dimension)
|
|
|
.withIndexFileSize(indexFileSize)
|
|
@@ -118,7 +118,7 @@ public class MilvusClientExample {
|
|
|
// We choose IVF_SQ8 as our index type here. Refer to IndexType javadoc for a
|
|
|
// complete explanation of different index types
|
|
|
final IndexType indexType = IndexType.IVF_SQ8;
|
|
|
- Index index = new Index.Builder().withIndexType(IndexType.IVF_SQ8).build();
|
|
|
+ Index index = new Index.Builder().withIndexType(indexType).build();
|
|
|
CreateIndexParam createIndexParam =
|
|
|
new CreateIndexParam.Builder(tableName).withIndex(index).build();
|
|
|
Response createIndexResponse = client.createIndex(createIndexParam);
|
|
@@ -168,7 +168,5 @@ public class MilvusClientExample {
|
|
|
System.out.println("Failed to disconnect: " + e.toString());
|
|
|
throw e;
|
|
|
}
|
|
|
-
|
|
|
- return;
|
|
|
}
|
|
|
}
|