use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class TargetIndexMatcherTest method withInAndNotIn.
@Test
public void withInAndNotIn() {
Query q = query("collId").filter(filter("a", "not-in", Arrays.asList(1, 2, 3))).filter(filter("b", "in", Arrays.asList(1, 2, 3)));
validateServesTarget(q, "a", FieldIndex.Segment.Kind.ASCENDING);
validateServesTarget(q, "b", FieldIndex.Segment.Kind.ASCENDING);
validateServesTarget(q, "b", FieldIndex.Segment.Kind.ASCENDING, "a", FieldIndex.Segment.Kind.ASCENDING);
// If provided, equalities have to come first
validateDoesNotServeTarget(q, "a", FieldIndex.Segment.Kind.ASCENDING, "b", FieldIndex.Segment.Kind.ASCENDING);
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class TargetIndexMatcherTest method withInAndOrderBySameField.
@Test
public void withInAndOrderBySameField() {
Query q = query("collId").filter(filter("a", "in", Arrays.asList(1, 2, 3))).orderBy(orderBy("a"));
validateServesTarget(q, "a", FieldIndex.Segment.Kind.ASCENDING);
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class TargetIndexMatcherTest method cannotUseOverspecifiedIndex.
@Test
public void cannotUseOverspecifiedIndex() {
Query q = query("collId").orderBy(orderBy("a"));
validateServesTarget(q, "a", FieldIndex.Segment.Kind.ASCENDING);
validateDoesNotServeTarget(q, "a", FieldIndex.Segment.Kind.ASCENDING, "b", FieldIndex.Segment.Kind.ASCENDING);
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class TargetIndexMatcherTest method withMultipleEqualities.
@Test
public void withMultipleEqualities() {
Query queriesMultipleFilters = query("collId").filter(filter("a1", "==", "a")).filter(filter("a2", "==", "b"));
validateServesTarget(queriesMultipleFilters, "a1", FieldIndex.Segment.Kind.ASCENDING, "a2", FieldIndex.Segment.Kind.ASCENDING);
validateServesTarget(queriesMultipleFilters, "a2", FieldIndex.Segment.Kind.ASCENDING, "a1", FieldIndex.Segment.Kind.ASCENDING);
validateDoesNotServeTarget(queriesMultipleFilters, "a1", FieldIndex.Segment.Kind.ASCENDING, "a2", FieldIndex.Segment.Kind.ASCENDING, "a3", FieldIndex.Segment.Kind.ASCENDING);
}
use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.
the class TargetIndexMatcherTest method multipleFiltersRequireMatchingPrefix.
@Test
public void multipleFiltersRequireMatchingPrefix() {
Query queriesMultipleFilters = query("collId").filter(filter("a", "==", "a")).filter(filter("b", ">", "b"));
validateServesTarget(queriesMultipleFilters, "b", FieldIndex.Segment.Kind.ASCENDING);
validateDoesNotServeTarget(queriesMultipleFilters, "c", FieldIndex.Segment.Kind.ASCENDING, "a", FieldIndex.Segment.Kind.ASCENDING);
}
Aggregations