This commit is contained in:
Kovid Goyal 2011-01-12 09:11:02 -07:00
parent fcbc4b331b
commit e3bbb4a0de
2 changed files with 6 additions and 8 deletions

View File

@ -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

View File

@ -341,10 +341,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
self.has_id = self.data.has_id self.has_id = self.data.has_id
self.count = self.data.count self.count = self.data.count
# Count times get_metadata is called, and how many times in the cache
self.gm_count = 0
self.gm_missed = 0
for prop in ('author_sort', 'authors', 'comment', 'comments', 'isbn', for prop in ('author_sort', 'authors', 'comment', 'comments', 'isbn',
'publisher', 'rating', 'series', 'series_index', 'tags', 'publisher', 'rating', 'series', 'series_index', 'tags',
'title', 'timestamp', 'uuid', 'pubdate', 'ondevice'): 'title', 'timestamp', 'uuid', 'pubdate', 'ondevice'):