View source on GitHub |
A filter that isolates correlated values and applies a sub-filter on them.
Inherits From: FilterPredicate
, expected_type
google.appengine.datastore.datastore_query.CorrelationFilter(
subfilter
)
This filter assumes that every property used by the sub-filter should be grouped before being passed to the sub-filter. The default grouping puts each value in its own group. Consider: e = {a: [1, 2], b: [2, 1, 3], c: 4}
A correlation filter with a sub-filter that operates on (a, b) will be tested against the following 3 sets of values: {a: 1, b: 2} {a: 2, b: 1} {b: 3}
In this case CorrelationFilter('a = 2 AND b = 2') won't match this entity but CorrelationFilter('a = 2 AND b = 1') will. To apply an uncorrelated filter on c, the filter must be applied in parallel to the correlation filter. For example: CompositeFilter(AND, [CorrelationFilter('a = 2 AND b = 1'), 'c = 3'])
If 'c = 3' was included in the correlation filter, c would be grouped as well. This would result in the following values: {a: 1, b: 2, c: 3} {a: 2, b: 1} {b: 3}
If any set of correlated values match the sub-filter then the entity matches the correlation filter.
Args | |
---|---|
subfilter
|
A FilterPredicate to apply to the correlated values |
Attributes | |
---|---|
subfilter
|
Methods
__call__
__call__(
entity
)
Applies the filter predicate to the given entity.
Args | |
---|---|
entity
|
the datastore_pb.EntityProto to test. |
Returns | |
---|---|
True if the given entity matches the filter, False otherwise. |
__eq__
__eq__(
other
)
Return self==value.
__ne__
__ne__(
other
)
Return self!=value.