Skip to content

Commit 14aaa9e

Browse files
committed
Update RRF retriever to return an error when the fields param is an empty array
1 parent f547134 commit 14aaa9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public RRFRetrieverBuilder(
115115
) {
116116
// Use a mutable list for childRetrievers so that we can use addChild
117117
super(childRetrievers == null ? new ArrayList<>() : new ArrayList<>(childRetrievers), rankWindowSize);
118-
this.fields = fields == null ? List.of() : List.copyOf(fields);
118+
this.fields = fields == null ? null : List.copyOf(fields);
119119
this.query = query;
120120
this.rankConstant = rankConstant;
121121
}
@@ -293,7 +293,7 @@ public void doToXContent(XContentBuilder builder, Params params) throws IOExcept
293293
builder.endArray();
294294
}
295295

296-
if (fields.isEmpty() == false) {
296+
if (fields != null) {
297297
builder.startArray(FIELDS_FIELD.getPreferredName());
298298
for (String field : fields) {
299299
builder.value(field);

0 commit comments

Comments
 (0)