Skip to content

Commit f1e14ce

Browse files
committed
Enforced weights as nonnull
1 parent 6d7e8ff commit f1e14ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ public RRFRetrieverBuilder(
133133
this.fields = fields == null ? null : List.copyOf(fields);
134134
this.query = query;
135135
this.rankConstant = rankConstant;
136-
if (weights != null && weights.length != innerRetrievers.size()) {
136+
Objects.requireNonNull(weights, "weights must not be null");
137+
if (weights.length != innerRetrievers.size()) {
137138
throw new IllegalArgumentException(
138139
"weights array length [" + weights.length + "] must match retrievers count [" + innerRetrievers.size() + "]"
139140
);

0 commit comments

Comments
 (0)