Fix problem in search -- the canidates parameter was not passed to get_dates_matches or get_numeric_matches, resulting in an exception.

This commit is contained in:
Charles Haley 2011-01-12 11:11:35 +00:00
parent dbacc79d97
commit bf183471ea

View File

@ -411,7 +411,8 @@ class ResultCache(SearchQueryParser): # {{{
if isinstance(location, list):
if allow_recursion:
for loc in location:
matches |= self.get_matches(loc, query, allow_recursion=False)
matches |= self.get_matches(loc, query, candidates,
allow_recursion=False)
return matches
raise ParseException(query, len(query), 'Recursive query group detected', self)
@ -419,11 +420,11 @@ class ResultCache(SearchQueryParser): # {{{
fm = self.field_metadata[location]
# take care of dates special case
if fm['datatype'] == 'datetime':
return self.get_dates_matches(location, query.lower())
return self.get_dates_matches(location, query.lower(), candidates)
# take care of numbers special case
if fm['datatype'] in ('rating', 'int', 'float'):
return self.get_numeric_matches(location, query.lower())
return self.get_numeric_matches(location, query.lower(), candidates)
# take care of the 'count' operator for is_multiples
if fm['is_multiple'] and \
@ -431,7 +432,8 @@ class ResultCache(SearchQueryParser): # {{{
query[1:1] in '=<>!':
vf = lambda item, loc=fm['rec_index'], ms=fm['is_multiple']:\
len(item[loc].split(ms)) if item[loc] is not None else 0
return self.get_numeric_matches(location, query[1:], val_func=vf)
return self.get_numeric_matches(location, query[1:],
candidates, val_func=vf)
# everything else, or 'all' matches
matchkind = CONTAINS_MATCH