Skip to content

Commit

Permalink
Fix a compatible bug for Gson 2.11.0+ (#1156)
Browse files Browse the repository at this point in the history
Signed-off-by: yhmo <[email protected]>
  • Loading branch information
yhmo authored Oct 30, 2024
1 parent adcce25 commit 94a89cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/main/java/io/milvus/v2/HybridSearchExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import io.milvus.v2.service.vector.request.data.BinaryVec;
import io.milvus.v2.service.vector.request.data.FloatVec;
import io.milvus.v2.service.vector.request.data.SparseFloatVec;
import io.milvus.v2.service.vector.request.ranker.RRFRanker;
import io.milvus.v2.service.vector.request.ranker.WeightedRanker;
import io.milvus.v2.service.vector.response.QueryResp;
import io.milvus.v2.service.vector.response.SearchResp;

Expand Down Expand Up @@ -213,7 +213,7 @@ private void hybridSearch() {
HybridSearchReq hybridSearchReq = HybridSearchReq.builder()
.collectionName(COLLECTION_NAME)
.searchRequests(searchRequests)
.ranker(new RRFRanker(2))
.ranker(new WeightedRanker(Arrays.asList(0.2f, 0.5f, 0.6f)))
.topK(5)
.consistencyLevel(ConsistencyLevel.BOUNDED)
.build();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/milvus/common/utils/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public static String toJson(JsonElement jsonElement) {
}

public static <T> JsonElement toJsonTree(T obj) {
return GSON_INSTANCE.toJsonTree(obj, new TypeToken<T>() {}.getType());
return GSON_INSTANCE.toJsonTree(obj);
}
}

0 comments on commit 94a89cc

Please sign in to comment.