use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method endAtWithFilterQueryBound.
@Test
public void endAtWithFilterQueryBound() {
// Tests that the endAt and the filter get merged to form a narrow bound
Target target = query("c").filter(filter("a", "<=", "a2")).filter(filter("b", "==", "b2")).orderBy(orderBy("a")).orderBy(orderBy("b")).endAt(bound(/* inclusive= */
true, "a1", "b1")).toTarget();
FieldIndex index = fieldIndex("c", "a", FieldIndex.Segment.Kind.ASCENDING, "b", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true, "", "b2");
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, true, "a1", "b1");
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method arrayContainsQueryBound.
@Test
public void arrayContainsQueryBound() {
Target target = query("c").filter(filter("foo", "array-contains", "bar")).toTarget();
FieldIndex index = fieldIndex("c", "foo", FieldIndex.Segment.Kind.CONTAINS);
List<Value> arrayValues = target.getArrayValues(index);
assertThat(arrayValues).containsExactly(wrap("bar"));
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true);
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, true);
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method lessThanQueryBound.
@Test
public void lessThanQueryBound() {
Target target = query("c").filter(filter("foo", "<", "bar")).toTarget();
FieldIndex index = fieldIndex("c", "foo", FieldIndex.Segment.Kind.DESCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true, "");
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, false, "bar");
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method arrayContainsAnyQueryBound.
@Test
public void arrayContainsAnyQueryBound() {
Target target = query("c").filter(filter("foo", "array-contains-any", Arrays.asList("bar", "baz"))).toTarget();
FieldIndex index = fieldIndex("c", "foo", FieldIndex.Segment.Kind.CONTAINS);
List<Value> arrayValues = target.getArrayValues(index);
assertThat(arrayValues).containsExactly(wrap("bar"), wrap("baz"));
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true);
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, true);
}
Aggregations