mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -423,12 +423,22 @@ class ResultCache(SearchQueryParser): # {{{
|
|||||||
return res
|
return res
|
||||||
user_cats = self.db_prefs.get('user_categories', [])
|
user_cats = self.db_prefs.get('user_categories', [])
|
||||||
c = set(candidates)
|
c = set(candidates)
|
||||||
|
l = location.rfind('.')
|
||||||
|
if l > 0:
|
||||||
|
alt_loc = location[0:l]
|
||||||
|
alt_item = location[l+1:]
|
||||||
for key in user_cats:
|
for key in user_cats:
|
||||||
if key == location or key.startswith(location + '.'):
|
if key == location or key.startswith(location + '.'):
|
||||||
for (item, category, ign) in user_cats[key]:
|
for (item, category, ign) in user_cats[key]:
|
||||||
s = self.get_matches(category, '=' + item, candidates=c)
|
s = self.get_matches(category, '=' + item, candidates=c)
|
||||||
c -= s
|
c -= s
|
||||||
res |= 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':
|
if query == 'false':
|
||||||
return candidates - res
|
return candidates - res
|
||||||
return res
|
return res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user