Search in sources :

Example 16 with Query

use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.

the class SQLiteIndexManagerTest method testNestedFieldEqualityFilter.

@Test
public void testNestedFieldEqualityFilter() {
    indexManager.addFieldIndex(fieldIndex("coll", "a.b", Kind.ASCENDING));
    addDoc("coll/doc1", map("a", map("b", 1)));
    addDoc("coll/doc2", map("a", map("b", 2)));
    Query query = query("coll").filter(filter("a.b", "==", 2));
    verifyResults(query, "coll/doc2");
}
Also used : Query(com.google.firebase.firestore.core.Query) Test(org.junit.Test)

Example 17 with Query

use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.

the class SQLiteIndexManagerTest method testNotInWithGreaterThanFilter.

@Test
public void testNotInWithGreaterThanFilter() {
    setUpSingleValueFilter();
    Query query = query("coll").filter(filter("count", ">", 1)).filter(filter("count", "not-in", Collections.singletonList(2)));
    verifyResults(query, "coll/val3");
}
Also used : Query(com.google.firebase.firestore.core.Query) Test(org.junit.Test)

Example 18 with Query

use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.

the class SQLiteIndexManagerTest method testStartAtFilter.

@Test
public void testStartAtFilter() {
    setUpSingleValueFilter();
    Query query = query("coll").orderBy(orderBy("count")).startAt(bound(/* inclusive= */
    true, 2));
    verifyResults(query, "coll/val2", "coll/val3");
}
Also used : Query(com.google.firebase.firestore.core.Query) Test(org.junit.Test)

Example 19 with Query

use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.

the class SQLiteIndexManagerTest method testEndBeforeFilter.

@Test
public void testEndBeforeFilter() {
    setUpSingleValueFilter();
    Query query = query("coll").orderBy(orderBy("count")).endAt(bound(/* inclusive= */
    false, 2));
    verifyResults(query, "coll/val1");
}
Also used : Query(com.google.firebase.firestore.core.Query) Test(org.junit.Test)

Example 20 with Query

use of com.google.firebase.firestore.core.Query in project firebase-android-sdk by firebase.

the class SQLiteIndexManagerTest method testIndexEntriesAreUpdatedWithDeletedDoc.

@Test
public void testIndexEntriesAreUpdatedWithDeletedDoc() {
    indexManager.addFieldIndex(fieldIndex("coll", "value", Kind.ASCENDING));
    Query query = query("coll").orderBy(orderBy("value"));
    addDoc("coll/doc1", map("value", true));
    verifyResults(query, "coll/doc1");
    addDocs(deletedDoc("coll/doc1", 1));
    verifyResults(query);
}
Also used : Query(com.google.firebase.firestore.core.Query) Test(org.junit.Test)

Aggregations

Query (com.google.firebase.firestore.core.Query)189 Test (org.junit.Test)179 BundledQuery (com.google.firebase.firestore.bundle.BundledQuery)40 NamedQuery (com.google.firebase.firestore.bundle.NamedQuery)39 StructuredQuery (com.google.firestore.v1.StructuredQuery)16 Target (com.google.firestore.v1.Target)13 DocumentsTarget (com.google.firestore.v1.Target.DocumentsTarget)13 QueryTarget (com.google.firestore.v1.Target.QueryTarget)13 DocumentSet (com.google.firebase.firestore.model.DocumentSet)12 MutableDocument (com.google.firebase.firestore.model.MutableDocument)8 ArrayList (java.util.ArrayList)8 TargetData (com.google.firebase.firestore.local.TargetData)7 FieldIndex (com.google.firebase.firestore.model.FieldIndex)7 DocumentKey (com.google.firebase.firestore.model.DocumentKey)6 ByteString (com.google.protobuf.ByteString)5 Document (com.google.firebase.firestore.model.Document)4 HashMap (java.util.HashMap)4 Target (com.google.firebase.firestore.core.Target)3 SnapshotVersion (com.google.firebase.firestore.model.SnapshotVersion)3 Map (java.util.Map)3