mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-04 05:04:48 +01:00
...
This commit is contained in:
parent
86d0715e71
commit
e6c651c5bf
2 changed files with 4 additions and 4 deletions
|
|
@ -926,7 +926,7 @@ def __call__(self, dbcache, query, search_restriction, virtual_fields=None, book
|
|||
finally:
|
||||
sqp.dbcache = sqp.lookup_saved_search = None
|
||||
|
||||
def _use_cache(self, sqp, dbcache, query):
|
||||
def query_is_cacheable(self, sqp, dbcache, query):
|
||||
if query:
|
||||
for name, value in sqp.get_queried_fields(query):
|
||||
if name == 'template' and '#@#:d:' in value:
|
||||
|
|
@ -949,7 +949,7 @@ def _do_search(self, sqp, query, search_restriction, dbcache, book_ids=None):
|
|||
query = query.decode('utf-8')
|
||||
|
||||
query = query.strip()
|
||||
use_cache = self._use_cache(sqp, dbcache, query)
|
||||
use_cache = self.query_is_cacheable(sqp, dbcache, query)
|
||||
|
||||
if use_cache and book_ids is None and query and not search_restriction:
|
||||
cached = self.cache.get(query)
|
||||
|
|
@ -960,7 +960,7 @@ def _do_search(self, sqp, query, search_restriction, dbcache, book_ids=None):
|
|||
if search_restriction and search_restriction.strip():
|
||||
sr = search_restriction.strip()
|
||||
sqp.all_book_ids = all_book_ids if book_ids is None else book_ids
|
||||
if self._use_cache(sqp, dbcache, sr):
|
||||
if self.query_is_cacheable(sqp, dbcache, sr):
|
||||
cached = self.cache.get(sr)
|
||||
if cached is None:
|
||||
restricted_ids = sqp.parse(sr)
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ def _walk_expr(self, tree):
|
|||
yield from self._walk_expr(self._get_tree(
|
||||
self._get_saved_search_text(tree[2])))
|
||||
else:
|
||||
yield (tree[1], tree[2])
|
||||
yield tree[1], tree[2]
|
||||
|
||||
def parse(self, query, candidates=None):
|
||||
# empty the list of searches used for recursion testing
|
||||
|
|
|
|||
Loading…
Reference in a new issue