map comp queries declaratively

Woohoo! More removal of special cases.
This commit is contained in:
Adrian Sampson 2014-01-21 19:13:16 -08:00
parent 74d0dc8352
commit d44f9f7052
2 changed files with 3 additions and 7 deletions

View file

@ -132,8 +132,8 @@ class BooleanQuery(MatchQuery):
"""Matches a boolean field. Pattern should either be a boolean or a
string reflecting a boolean.
"""
def __init__(self, field, pattern):
super(BooleanQuery, self).__init__(field, pattern)
def __init__(self, field, pattern, fast=True):
super(BooleanQuery, self).__init__(field, pattern, fast)
if isinstance(pattern, basestring):
self.pattern = util.str2bool(pattern)
self.pattern = int(self.pattern)

View file

@ -828,12 +828,8 @@ def construct_query_part(query_part, model_cls):
key = key.lower()
# A boolean field.
if key.lower() == 'comp':
return dbcore.query.BooleanQuery(key, pattern)
# Singleton query (not a real field).
elif key == 'singleton':
if key == 'singleton':
return SingletonQuery(util.str2bool(pattern))
# Other field.