Search in sources :

Example 1 with CompositeFilter

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

the class SQLiteIndexManager method getSubTargets.

private List<Target> getSubTargets(Target target) {
    if (targetToDnfSubTargets.containsKey(target)) {
        return targetToDnfSubTargets.get(target);
    }
    List<Target> subTargets = new ArrayList<>();
    if (target.getFilters().isEmpty()) {
        subTargets.add(target);
    } else {
        // There is an implicit AND operation between all the filters stored in the target.
        List<Filter> dnf = LogicUtils.DnfTransform(new CompositeFilter(target.getFilters(), StructuredQuery.CompositeFilter.Operator.AND));
        for (Filter term : dnf) {
            subTargets.add(new Target(target.getPath(), target.getCollectionGroup(), term.getFilters(), target.getOrderBy(), target.getLimit(), target.getStartAt(), target.getEndAt()));
        }
    }
    targetToDnfSubTargets.put(target, subTargets);
    return subTargets;
}
Also used : Target(com.google.firebase.firestore.core.Target) CompositeFilter(com.google.firebase.firestore.core.CompositeFilter) FieldFilter(com.google.firebase.firestore.core.FieldFilter) Filter(com.google.firebase.firestore.core.Filter) CompositeFilter(com.google.firebase.firestore.core.CompositeFilter) ArrayList(java.util.ArrayList)

Aggregations

CompositeFilter (com.google.firebase.firestore.core.CompositeFilter)1 FieldFilter (com.google.firebase.firestore.core.FieldFilter)1 Filter (com.google.firebase.firestore.core.Filter)1 Target (com.google.firebase.firestore.core.Target)1 ArrayList (java.util.ArrayList)1