mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use the template cache to speed up evaluation when searching using templates.
This commit is contained in:
parent
ae189e0eee
commit
c3867b3473
@ -643,9 +643,12 @@ class Parser(SearchQueryParser): # {{{
|
||||
matchkind, query = _matchkind(query, case_sensitive=case_sensitive)
|
||||
matches = set()
|
||||
error_string = '*@*TEMPLATE_ERROR*@*'
|
||||
template_cache = {}
|
||||
for book_id in candidates:
|
||||
mi = self.dbcache.get_proxy_metadata(book_id)
|
||||
val = mi.formatter.safe_format(template, {}, error_string, mi)
|
||||
val = mi.formatter.safe_format(template, {}, error_string, mi,
|
||||
column_name='search template',
|
||||
template_cache=template_cache)
|
||||
if val.startswith(error_string):
|
||||
raise ParseException(val[len(error_string):])
|
||||
if sep == 't':
|
||||
|
Loading…
x
Reference in New Issue
Block a user