Browse Source

Merge pull request #136 from sahuang/0.9.0_update

Polish documentation
Xiaohai Xu 4 years ago
parent
commit
d2b8a10df5
5 changed files with 42 additions and 24 deletions
  1. 18 1
      CHANGELOG.md
  2. 8 5
      README.md
  3. 5 5
      examples/pom.xml
  4. 10 12
      examples/src/main/java/MilvusClientExample.java
  5. 1 1
      pom.xml

+ 18 - 1
CHANGELOG.md

@@ -1,10 +1,27 @@
 # Changelog   
 
+## milvus-sdk-java 0.9.0 (2020-10-16)
+
+### Feature
+
+- \#2976 Scalar-field filtering support
+
+### Improvement
+
+- \#134 - Simplify the client code
+
+## milvus-sdk-java 0.8.5 (2020-08-26)
+
+### Feature
+
+- \#128 - GRPC timeout support
+- \#129 - Support GRPC name resolver and load balancing
+
 ## milvus-sdk-java 0.8.3 (2020-07-15)
 
 ### Improvement
 
-- \#117 - Remove isConnect() API
+- \#118 - Remove isConnect() API
 
 ## milvus-sdk-java 0.8.0 (2020-05-15)
 

+ 8 - 5
README.md

@@ -57,11 +57,13 @@ Please refer to [examples](https://github.com/milvus-io/milvus-sdk-java/tree/mas
 
 ### Troubleshooting
 
-- If you encounter the following error when running your application:
+- If you encounter the following error when running `MilvusClientExample.java`:
     ```
-    Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
+    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
+    SLF4J: Defaulting to no-operation (NOP) logger implementation
+    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
     ```
-  This is because SLF4J jar files need to be added into your application's classpath. SLF4J is required by Java SDK for logging purpose.
+  This is because SLF4J jar files need to be added into your application's classpath. SLF4J is used by Java SDK for logging purpose.
   
   To fix this issue, you can use **Apache Maven** or **Gradle**/**Grails** to download the required jar files.
                                                                                                          
@@ -70,13 +72,14 @@ Please refer to [examples](https://github.com/milvus-io/milvus-sdk-java/tree/mas
         ```xml
          <dependency>
              <groupId>org.slf4j</groupId>
-             <artifactId>slf4j-api</artifactId>
+             <artifactId>slf4j-simple</artifactId>
              <version>1.7.30</version>
+             <scope>test</scope>
          </dependency>
         ```
     
     - Gradle/Grails
     
          ```gradle
-         compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
+         test compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
          ```

+ 5 - 5
examples/pom.xml

@@ -25,7 +25,7 @@
 
     <groupId>io.milvus</groupId>
     <artifactId>milvus-sdk-java-examples</artifactId>
-    <version>0.9.0-SNAPSHOT</version>
+    <version>0.9.0</version>
     <build>
         <plugins>
             <plugin>
@@ -63,12 +63,12 @@
         <dependency>
             <groupId>io.milvus</groupId>
             <artifactId>milvus-sdk-java</artifactId>
-            <version>0.9.0-SNAPSHOT</version>
+            <version>0.9.0</version>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>testcontainers</artifactId>
-            <version>1.14.3</version>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>1.7.30</version>
         </dependency>
     </dependencies>
 

+ 10 - 12
examples/src/main/java/MilvusClientExample.java

@@ -20,7 +20,6 @@
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import io.milvus.client.*;
-import org.testcontainers.containers.GenericContainer;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -50,8 +49,7 @@ public class MilvusClientExample {
     return vectors;
   }
 
-  // Helper function that normalizes a vector if you are using IP (Inner Product) as your metric
-  // type
+  // 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);
     final float norm = (float) Math.sqrt(squareSum);
@@ -59,15 +57,12 @@ public class MilvusClientExample {
     return vector;
   }
 
-  public static void main(String[] args) throws InterruptedException {
-    String dockerImage = System.getProperty("docker_image_name", "milvusdb/milvus:0.11.0-cpu");
-    try (GenericContainer milvusContainer = new GenericContainer(dockerImage).withExposedPorts(19530)) {
-      milvusContainer.start();
-      ConnectParam connectParam = new ConnectParam.Builder()
-          .withHost("localhost")
-          .withPort(milvusContainer.getFirstMappedPort())
-          .build();
+  public static void main(String[] args) {
+    try {
+      ConnectParam connectParam = new ConnectParam.Builder().build();
       run(connectParam);
+    } catch (Exception e) {
+      e.printStackTrace();
     }
   }
 
@@ -76,7 +71,7 @@ public class MilvusClientExample {
     MilvusClient client = new MilvusGrpcClient(connectParam).withLogging();
 
     // Create a collection with the following collection mapping
-    final String collectionName = "example"; // collection name
+    final String collectionName = "example_collection"; // collection name
     final int dimension = 128; // dimension of each vector
     // we choose IP (Inner Product) as our metric type
     CollectionMapping collectionMapping = CollectionMapping
@@ -210,5 +205,8 @@ public class MilvusClientExample {
 
     // Drop collection
     client.dropCollection(collectionName);
+
+    // Close connection
+    client.close();
   }
 }

+ 1 - 1
pom.xml

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