mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #4888 (Exact match search doesn't work when book has multiple formats)
This commit is contained in:
parent
4b6e4d9ae4
commit
2c78cee8e7
@ -241,6 +241,7 @@ class ResultCache(SearchQueryParser):
|
|||||||
for x in all:
|
for x in all:
|
||||||
MAP[x] = FIELD_MAP[x]
|
MAP[x] = FIELD_MAP[x]
|
||||||
EXCLUDE_FIELDS = [MAP['rating'], MAP['cover']]
|
EXCLUDE_FIELDS = [MAP['rating'], MAP['cover']]
|
||||||
|
SPLITABLE_FIELDS = [MAP['authors'], MAP['tags'], MAP['formats']]
|
||||||
location = [location] if location != 'all' else list(MAP.keys())
|
location = [location] if location != 'all' else list(MAP.keys())
|
||||||
for i, loc in enumerate(location):
|
for i, loc in enumerate(location):
|
||||||
location[i] = MAP[loc]
|
location[i] = MAP[loc]
|
||||||
@ -275,8 +276,8 @@ class ResultCache(SearchQueryParser):
|
|||||||
matches.add(item[0])
|
matches.add(item[0])
|
||||||
continue
|
continue
|
||||||
if loc not in EXCLUDE_FIELDS:
|
if loc not in EXCLUDE_FIELDS:
|
||||||
if loc == MAP['tags'] or loc == MAP['authors']:
|
if loc in SPLITABLE_FIELDS:
|
||||||
vals = item[loc].split(',') ### check individual tags/authors, not the long string
|
vals = item[loc].split(',') ### check individual tags/authors/formats, not the long string
|
||||||
else:
|
else:
|
||||||
vals = [item[loc]] ### make into list to make _match happy
|
vals = [item[loc]] ### make into list to make _match happy
|
||||||
if _match(q, vals, matchkind):
|
if _match(q, vals, matchkind):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user