mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 17:04:39 +02:00
Change search to match a tag item X when a user category path @A.X is searched, in addition to the items in category A.X
This commit is contained in:
parent
68af4f7a1b
commit
82e23f1bd7
1 changed files with 10 additions and 0 deletions
|
|
@ -423,12 +423,22 @@ def get_user_category_matches(self, location, query, candidates):
|
|||
return res
|
||||
user_cats = self.db_prefs.get('user_categories', [])
|
||||
c = set(candidates)
|
||||
l = location.rfind('.')
|
||||
if l > 0:
|
||||
alt_loc = location[0:l]
|
||||
alt_item = location[l+1:]
|
||||
for key in user_cats:
|
||||
if key == location or key.startswith(location + '.'):
|
||||
for (item, category, ign) in user_cats[key]:
|
||||
s = self.get_matches(category, '=' + item, candidates=c)
|
||||
c -= s
|
||||
res |= s
|
||||
elif key == alt_loc:
|
||||
for (item, category, ign) in user_cats[key]:
|
||||
if item == alt_item:
|
||||
s = self.get_matches(category, '=' + item, candidates=c)
|
||||
c -= s
|
||||
res |= s
|
||||
if query == 'false':
|
||||
return candidates - res
|
||||
return res
|
||||
|
|
|
|||
Loading…
Reference in a new issue