mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-30 22:25:23 +01:00
Fix searching by tag,author and format on devices. Fixes #2806 (Search interface does not work properly in the reader pane)
This commit is contained in:
parent
24d76bd8a4
commit
ebcab0d2d3
1 changed files with 6 additions and 5 deletions
|
|
@ -844,14 +844,15 @@ def universal_set(self):
|
|||
def get_matches(self, location, query):
|
||||
location = location.lower().strip()
|
||||
query = query.lower().strip()
|
||||
if location not in ('title', 'authors', 'tags', 'all'):
|
||||
if location not in ('title', 'author', 'tag', 'all', 'format'):
|
||||
return set([])
|
||||
matches = set([])
|
||||
locations = ['title', 'authors', 'tags'] if location == 'all' else [location]
|
||||
locations = ['title', 'author', 'tag', 'format'] if location == 'all' else [location]
|
||||
q = {
|
||||
'title' : lambda x : getattr(x, 'title').lower(),
|
||||
'authors': lambda x: getattr(x, 'authors').lower(),
|
||||
'tags':lambda x: ','.join(getattr(x, 'tags')).lower()
|
||||
'author': lambda x: getattr(x, 'authors').lower(),
|
||||
'tag':lambda x: ','.join(getattr(x, 'tags')).lower(),
|
||||
'format':lambda x: os.path.splitext(x.path)[1].lower()
|
||||
}
|
||||
for i, v in enumerate(locations):
|
||||
locations[i] = q[v]
|
||||
|
|
@ -870,7 +871,7 @@ def __init__(self, parent):
|
|||
self.db = []
|
||||
self.map = []
|
||||
self.sorted_map = []
|
||||
self.unknown = str(self.trUtf8('Unknown'))
|
||||
self.unknown = _('Unknown')
|
||||
self.marked_for_deletion = {}
|
||||
self.search_engine = OnDeviceSearch(self)
|
||||
self.editable = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue