+ if sizeq and len(sizeq) == 2:
+ if sizeq[0]:
+ s = s.where(v.c.size >= sizeq[0])
+ if sizeq[1]:
+ s = s.where(v.c.size < sizeq[1])
+
+ if domain and filterq:
+ a = self.attributes.alias('a')
+ included, excluded, opers = parse_filters(filterq)
+ if included:
+ subs = select([1])
+ subs = subs.where(a.c.serial == v.c.serial).correlate(v)
+ subs = subs.where(a.c.domain == domain)
+ subs = subs.where(or_(*[a.c.key.op('=')(x) for x in included]))
+ s = s.where(exists(subs))
+ if excluded:
+ subs = select([1])
+ subs = subs.where(a.c.serial == v.c.serial).correlate(v)
+ subs = subs.where(a.c.domain == domain)
+ subs = subs.where(or_(*[a.c.key.op('=')(x) for x in excluded]))
+ s = s.where(not_(exists(subs)))
+ if opers:
+ for k, o, val in opers:
+ subs = select([1])
+ subs = subs.where(a.c.serial == v.c.serial).correlate(v)
+ subs = subs.where(a.c.domain == domain)
+ subs = subs.where(and_(a.c.key.op('=')(k), a.c.value.op(o)(val)))
+ s = s.where(exists(subs))