use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method filterWithOrderByQueryBound.
@Test
public void filterWithOrderByQueryBound() {
Target target = query("c").filter(filter("foo", ">", "bar")).orderBy(orderBy("foo")).toTarget();
FieldIndex index = fieldIndex("c", "foo", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, false, "bar");
Bound upperBound = target.getUpperBound(index);
verifyBound(upperBound, false, blob());
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method orderByQueryBound.
@Test
public void orderByQueryBound() {
Target target = query("c").orderBy(orderBy("foo")).toTarget();
FieldIndex index = fieldIndex("c", "foo", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
assertNull(lowerBound);
Bound upperBound = target.getUpperBound(index);
assertNull(upperBound);
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class TargetTest method endBeforeDoesNotChangeBoundIfNotApplicable.
@Test
public void endBeforeDoesNotChangeBoundIfNotApplicable() {
Target target = query("c").filter(filter("a", "<=", "a1")).filter(filter("b", "==", "b1")).orderBy(orderBy("a")).orderBy(orderBy("b")).endAt(bound(/* inclusive= */
false, "a2", "b2")).toTarget();
FieldIndex index = fieldIndex("c", "a", FieldIndex.Segment.Kind.ASCENDING, "b", FieldIndex.Segment.Kind.ASCENDING);
Bound lowerBound = target.getLowerBound(index);
verifyBound(lowerBound, true, "", "b1");
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 SQLiteIndexManagerTest method testPersistsIndexOffset.
@Test
public void testPersistsIndexOffset() {
indexManager.addFieldIndex(fieldIndex("coll1", "value", Kind.ASCENDING));
IndexOffset offset = IndexOffset.create(version(20), key("coll/doc"), 42);
indexManager.updateCollectionGroup("coll1", offset);
indexManager = persistence.getIndexManager(User.UNAUTHENTICATED);
indexManager.start();
Collection<FieldIndex> indexes = indexManager.getFieldIndexes("coll1");
assertEquals(indexes.size(), 1);
FieldIndex index = indexes.iterator().next();
assertEquals(offset, index.getIndexState().getOffset());
}
use of com.google.firebase.firestore.model.FieldIndex in project firebase-android-sdk by firebase.
the class SQLiteIndexManagerTest method testDeleteFieldIndexRemovesAllMetadata.
@Test
public void testDeleteFieldIndexRemovesAllMetadata() {
indexManager.addFieldIndex(fieldIndex("coll", 1, IndexState.create(1, IndexOffset.NONE), "value", Kind.ASCENDING));
addDoc("coll/doc", map("value", 1));
indexManager.updateCollectionGroup("coll", IndexOffset.NONE);
validateRowCount(1);
FieldIndex existingIndex = indexManager.getFieldIndexes("coll").iterator().next();
indexManager.deleteFieldIndex(existingIndex);
validateRowCount(0);
}
Aggregations