Selaa lähdekoodia

Merge pull request #86 from youny626/0.6.0

Release Java SDK 0.6.0, for Milvus 0.7.1
Zhiru Zhu 5 vuotta sitten
vanhempi
commit
9d74c4ecca

+ 11 - 0
CHANGELOG.md

@@ -1,5 +1,16 @@
 # Changelog     
 
+## milvus-sdk-java 0.6.0 (2020-03-31)
+
+### Bug
+---
+- \#1641 - Fix incorrect error logging message
+- \#1642 - Fix compilation error of ByteBuffer
+
+## Feature
+---
+- \#1603 - Add binary metrics: Substructure & Superstructure
+
 ## milvus-sdk-java 0.5.0 (2020-03-11)
 
 ## milvus-sdk-java 0.4.1 (2019-12-16)

+ 3 - 2
README.md

@@ -21,6 +21,7 @@ The following table shows compatibilities between Milvus and Java SDK.
    |     0.5.3      |    0.3.0    |
    |     0.6.0      |    0.4.1    |
    |     0.7.0      |    0.5.0    |
+   |     0.7.1      |    0.6.0    |
 
 ### Install Java SDK
 
@@ -32,14 +33,14 @@ You can use **Apache Maven** or **Gradle**/**Grails** to download the SDK.
         <dependency>
             <groupId>io.milvus</groupId>
             <artifactId>milvus-sdk-java</artifactId>
-            <version>0.5.0</version>
+            <version>0.6.0</version>
         </dependency>
        ```
 
    - Gradle/Grails
 
         ```gradle
-        compile 'io.milvus:milvus-sdk-java:0.5.0'
+        compile 'io.milvus:milvus-sdk-java:0.6.0'
         ```
 
 ### Examples

+ 1 - 1
examples/pom.xml

@@ -63,7 +63,7 @@
         <dependency>
             <groupId>io.milvus</groupId>
             <artifactId>milvus-sdk-java</artifactId>
-            <version>0.5.0-SNAPSHOT</version>
+            <version>0.6.0</version>
         </dependency>
         <dependency>
             <groupId>com.google.code.gson</groupId>

+ 3 - 0
examples/src/main/java/MilvusClientExample.java

@@ -165,6 +165,9 @@ public class MilvusClientExample {
         }
       }
     }
+    // You can also get result ids and distances separately
+    List<List<Long>> resultIds = searchResponse.getResultIdsList();
+    List<List<Float>> resultDistances = searchResponse.getResultDistancesList();
 
     // Delete the first 5 of vectors you just searched
     Response deleteByIdsResponse =

+ 0 - 2
milvus-sdk-java.iml

@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4" />

+ 1 - 1
pom.xml

@@ -25,7 +25,7 @@
 
     <groupId>io.milvus</groupId>
     <artifactId>milvus-sdk-java</artifactId>
-    <version>0.5.0</version>
+    <version>0.6.0</version>
     <packaging>jar</packaging>
 
     <name>io.milvus:milvus-sdk-java</name>

+ 4 - 0
src/main/java/io/milvus/client/MetricType.java

@@ -35,6 +35,10 @@ public enum MetricType {
   JACCARD(4),
   /** Tanimoto distance. For binary vectors only */
   TANIMOTO(5),
+  /** Substructure: D(a, b) = 1 - N(a&b) / N(b). For binary vectors only */
+  SUBSTRUCTURE(6),
+  /** Superstructure: D(a, b) = 1 - N(a&b) / N(a). For binary vectors only */
+  SUPERSTRUCTURE(7),
 
   UNKNOWN(-1);
 

+ 2 - 2
src/main/java/io/milvus/client/MilvusClient.java

@@ -24,9 +24,9 @@ import java.util.List;
 /** The Milvus Client Interface */
 public interface MilvusClient {
 
-  String clientVersion = "0.5.0";
+  String clientVersion = "0.6.0";
 
-  /** @return current Milvus client version: 0.5.0 */
+  /** @return current Milvus client version: 0.6.0 */
   default String getClientVersion() {
     return clientVersion;
   }

+ 17 - 11
src/main/java/io/milvus/client/MilvusGrpcClient.java

@@ -27,6 +27,7 @@ import io.grpc.StatusRuntimeException;
 import org.apache.commons.collections4.ListUtils;
 
 import javax.annotation.Nonnull;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
@@ -418,7 +419,7 @@ public class MilvusGrpcClient implements MilvusClient {
         return new InsertResponse(
             new Response(Response.Status.SUCCESS), response.getVectorIdArrayList());
       } else {
-        logSevere("Insert vectors failed:\n{0}", response.toString());
+        logSevere("Insert vectors failed:\n{0}", response.getStatus().toString());
         return new InsertResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -473,7 +474,7 @@ public class MilvusGrpcClient implements MilvusClient {
             searchResponse.getNumQueries());
         return searchResponse;
       } else {
-        logSevere("Search failed:\n{0}", response.toString());
+        logSevere("Search failed:\n{0}", response.getStatus().toString());
         SearchResponse searchResponse = new SearchResponse();
         searchResponse.setResponse(
             new Response(
@@ -537,7 +538,7 @@ public class MilvusGrpcClient implements MilvusClient {
             searchResponse.getNumQueries());
         return searchResponse;
       } else {
-        logSevere("Search in files failed: {0}", response.toString());
+        logSevere("Search in files failed: {0}", response.getStatus().toString());
 
         SearchResponse searchResponse = new SearchResponse();
         searchResponse.setResponse(
@@ -580,7 +581,9 @@ public class MilvusGrpcClient implements MilvusClient {
         return new DescribeCollectionResponse(
             new Response(Response.Status.SUCCESS), collectionMapping);
       } else {
-        logSevere("Describe Collection `{0}` failed:\n{1}", collectionName, response.toString());
+        logSevere(
+            "Describe Collection `{0}` failed:\n{1}",
+            collectionName, response.getStatus().toString());
         return new DescribeCollectionResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -614,7 +617,7 @@ public class MilvusGrpcClient implements MilvusClient {
         logInfo("Current collections: {0}", collectionNames.toString());
         return new ShowCollectionsResponse(new Response(Response.Status.SUCCESS), collectionNames);
       } else {
-        logSevere("Show collections failed:\n{0}", response.toString());
+        logSevere("Show collections failed:\n{0}", response.getStatus().toString());
         return new ShowCollectionsResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -651,7 +654,8 @@ public class MilvusGrpcClient implements MilvusClient {
             new Response(Response.Status.SUCCESS), collectionRowCount);
       } else {
         logSevere(
-            "Get collection `{0}` row count failed:\n{1}", collectionName, response.toString());
+            "Get collection `{0}` row count failed:\n{1}",
+            collectionName, response.getStatus().toString());
         return new GetCollectionRowCountResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -764,7 +768,7 @@ public class MilvusGrpcClient implements MilvusClient {
       } else {
         logSevere(
             "Describe index for collection `{0}` failed:\n{1}",
-            collectionName, response.toString());
+            collectionName, response.getStatus().toString());
         return new DescribeIndexResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -854,7 +858,9 @@ public class MilvusGrpcClient implements MilvusClient {
         return new ShowCollectionInfoResponse(
             new Response(Response.Status.SUCCESS), collectionInfo);
       } else {
-        logSevere("ShowCollectionInfo for `{0}` failed:\n{1}", collectionName, response.toString());
+        logSevere(
+            "ShowCollectionInfo for `{0}` failed:\n{1}",
+            collectionName, response.getStatus().toString());
         return new ShowCollectionInfoResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -895,7 +901,7 @@ public class MilvusGrpcClient implements MilvusClient {
       } else {
         logSevere(
             "getVectorById for `{0}` in collection `{1}` failed:\n{2}",
-            String.valueOf(id), collectionName, response.toString());
+            String.valueOf(id), collectionName, response.getStatus().toString());
         return new GetVectorByIdResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -938,7 +944,7 @@ public class MilvusGrpcClient implements MilvusClient {
       } else {
         logSevere(
             "getVectorIds in collection `{0}`, segment `{1}` failed:\n{2}",
-            collectionName, segmentName, response.toString());
+            collectionName, segmentName, response.getStatus().toString());
         return new GetVectorIdsResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
@@ -1077,7 +1083,7 @@ public class MilvusGrpcClient implements MilvusClient {
         rowRecordBuilder.addAllFloatData(floatVectors.get(i));
       }
       if (i < binaryVectors.size()) {
-        binaryVectors.get(i).rewind();
+        ((Buffer) binaryVectors.get(i)).rewind();
         rowRecordBuilder.setBinaryData(ByteString.copyFrom(binaryVectors.get(i)));
       }