mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-02-03 18:03:56 +01:00
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:
parent
dbacc79d97
commit
bf183471ea
1 changed files with 6 additions and 4 deletions
|
|
@ -411,7 +411,8 @@ def get_matches(self, location, query, allow_recursion=True, candidates=None):
|
|||
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 @@ def get_matches(self, location, query, allow_recursion=True, candidates=None):
|
|||
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 @@ def get_matches(self, location, query, allow_recursion=True, candidates=None):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue