mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04: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
@ -411,7 +411,8 @@ class ResultCache(SearchQueryParser): # {{{
|
|||||||
if isinstance(location, list):
|
if isinstance(location, list):
|
||||||
if allow_recursion:
|
if allow_recursion:
|
||||||
for loc in location:
|
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
|
return matches
|
||||||
raise ParseException(query, len(query), 'Recursive query group detected', self)
|
raise ParseException(query, len(query), 'Recursive query group detected', self)
|
||||||
|
|
||||||
@ -419,11 +420,11 @@ class ResultCache(SearchQueryParser): # {{{
|
|||||||
fm = self.field_metadata[location]
|
fm = self.field_metadata[location]
|
||||||
# take care of dates special case
|
# take care of dates special case
|
||||||
if fm['datatype'] == 'datetime':
|
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
|
# take care of numbers special case
|
||||||
if fm['datatype'] in ('rating', 'int', 'float'):
|
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
|
# take care of the 'count' operator for is_multiples
|
||||||
if fm['is_multiple'] and \
|
if fm['is_multiple'] and \
|
||||||
@ -431,7 +432,8 @@ class ResultCache(SearchQueryParser): # {{{
|
|||||||
query[1:1] in '=<>!':
|
query[1:1] in '=<>!':
|
||||||
vf = lambda item, loc=fm['rec_index'], ms=fm['is_multiple']:\
|
vf = lambda item, loc=fm['rec_index'], ms=fm['is_multiple']:\
|
||||||
len(item[loc].split(ms)) if item[loc] is not None else 0
|
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
|
# everything else, or 'all' matches
|
||||||
matchkind = CONTAINS_MATCH
|
matchkind = CONTAINS_MATCH
|
||||||
|
Loading…
x
Reference in New Issue
Block a user