Skip to content

Commit a7796a1

Browse files
authored
Fix a compatible issue of RRFRanker/WeightedRanker (#1522)
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent 2e821a8 commit a7796a1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

sdk-core/src/main/java/io/milvus/v2/service/vector/request/ranker/RRFRanker.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@
5151
*/
5252
@SuperBuilder
5353
public class RRFRanker extends CreateCollectionReq.Function {
54+
// This constructor is to compatible with the old client code like:
55+
// new RRFRanker(10)
56+
// Now it is deprecated, user should create a RRFRanker by builder style:
57+
// RRFRanker.builder().k(10).build()
58+
@Deprecated
59+
public RRFRanker(int k) {
60+
super(CreateCollectionReq.Function.builder());
61+
this.k = k;
62+
}
63+
5464
@Builder.Default
5565
private int k = 60;
5666

sdk-core/src/main/java/io/milvus/v2/service/vector/request/ranker/WeightedRanker.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@
5555
*/
5656
@SuperBuilder
5757
public class WeightedRanker extends CreateCollectionReq.Function {
58+
// This constructor is to compatible with the old client code like:
59+
// new WeightedRanker(weights)
60+
// Now it is deprecated, user should create a WeightedRanker by builder style:
61+
// WeightedRanker.builder().weights(weights).build()
62+
@Deprecated
63+
public WeightedRanker(List<Float> weights) {
64+
super(CreateCollectionReq.Function.builder());
65+
this.weights = weights;
66+
}
67+
5868
@Builder.Default
5969
private List<Float> weights = new ArrayList<>();
6070

0 commit comments

Comments
 (0)