Browse Source

Fix topK

Signed-off-by: sahuang <xiaohai.xu@zilliz.com>
sahuang 4 years ago
parent
commit
288b05aa31
1 changed files with 2 additions and 2 deletions
  1. 2 2
      examples/src/main/java/MilvusIndexExample.java

+ 2 - 2
examples/src/main/java/MilvusIndexExample.java

@@ -174,12 +174,12 @@ public class MilvusIndexExample {
      *   Here we present a way to use predefined schema to search vectors.
      */
     List<List<Float>> queryEmbedding = randomFloatVectors(1, dimension);
-    final long topK = 3;
+    final int topK = 3;
     Query query = Query.bool(Query.must(
         filmSchema.releaseYear.in(1995, 2002),
         filmSchema.embedding.query(queryEmbedding)
             .metricType(MetricType.L2)
-            .top((int) topK)
+            .top(topK)
             .param("nprobe", 8)));
     SearchParam searchParam = service.buildSearchParam(query)
         .setParamsInJson("{\"fields\": [\"release_year\", \"embedding\"]}");