Skip to content

Commit 065235f

Browse files
committed
Fix
1 parent b4f04ac commit 065235f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/core/CompositeFilter.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,16 @@ public String getCanonicalId() {
170170

171171
@Override
172172
BooleanExpr toPipelineExpr() {
173-
BooleanExpr[] booleanExprs =
174-
filters.stream().map(Filter::toPipelineExpr).toArray(BooleanExpr[]::new);
173+
BooleanExpr first = filters.get(0).toPipelineExpr();
174+
BooleanExpr[] additional = new BooleanExpr[filters.size() - 1];
175+
for (int i = 1, filtersSize = filters.size(); i < filtersSize; i++) {
176+
additional[i - 1] = filters.get(i).toPipelineExpr();
177+
}
175178
switch (operator) {
176179
case AND:
177-
return new BooleanExpr("and", booleanExprs);
180+
return BooleanExpr.and(first, additional);
178181
case OR:
179-
return new BooleanExpr("or", booleanExprs);
182+
return BooleanExpr.or(first, additional);
180183
}
181184
// Handle OPERATOR_UNSPECIFIED and UNRECOGNIZED cases as needed
182185
throw new IllegalArgumentException("Unsupported operator: " + operator);

0 commit comments

Comments
 (0)