mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add ability to search for books in a vl (vl:foo).
Fix not recomputing the search cache when vls are edited.
This commit is contained in:
parent
c90a726acc
commit
622833eb05
@ -498,6 +498,15 @@ class Parser(SearchQueryParser): # {{{
|
|||||||
if location not in self.all_search_locations:
|
if location not in self.all_search_locations:
|
||||||
return matches
|
return matches
|
||||||
|
|
||||||
|
if location == 'vl':
|
||||||
|
vl = self.dbcache._pref('virtual_libraries', {}).get(query) if query else None
|
||||||
|
if not vl:
|
||||||
|
raise ParseException(_('No such virtual library: {0}').format(query))
|
||||||
|
try:
|
||||||
|
return candidates & self.dbcache.books_in_virtual_library(query)
|
||||||
|
except (RuntimeError):
|
||||||
|
raise ParseException(_('Virtual library search is recursive: {0}').format(query))
|
||||||
|
|
||||||
if (len(location) > 2 and location.startswith('@') and
|
if (len(location) > 2 and location.startswith('@') and
|
||||||
location[1:] in self.grouped_search_terms):
|
location[1:] in self.grouped_search_terms):
|
||||||
location = location[1:]
|
location = location[1:]
|
||||||
|
@ -380,7 +380,7 @@ class FieldMetadata(object):
|
|||||||
'int', 'float', 'bool', 'series', 'composite', 'enumeration'])
|
'int', 'float', 'bool', 'series', 'composite', 'enumeration'])
|
||||||
|
|
||||||
# search labels that are not db columns
|
# search labels that are not db columns
|
||||||
search_items = ['all', 'search']
|
search_items = ['all', 'search', 'vl']
|
||||||
__calibre_serializable__ = True
|
__calibre_serializable__ = True
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user