mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 14:35:46 +02:00
Fix searching on is_multiple composite columns.
This commit is contained in:
parent
a4e0eeb854
commit
6d41bf2f5e
1 changed files with 9 additions and 1 deletions
|
|
@ -216,8 +216,16 @@ def sort_keys_for_books(self, get_metadata, lang_map, all_book_ids):
|
|||
|
||||
def iter_searchable_values(self, get_metadata, candidates, default_value=None):
|
||||
val_map = defaultdict(set)
|
||||
splitter = self.table.metadata['is_multiple'].get('cache_to_list', None)
|
||||
for book_id in candidates:
|
||||
val_map[self.get_value_with_cache(book_id, get_metadata)].add(book_id)
|
||||
vals = self.get_value_with_cache(book_id, get_metadata)
|
||||
if splitter:
|
||||
vals = [vv.strip() for vv in vals.split(splitter)]
|
||||
else:
|
||||
vals = [vals]
|
||||
for v in vals:
|
||||
if v:
|
||||
val_map[v].add(book_id)
|
||||
for val, book_ids in val_map.iteritems():
|
||||
yield val, book_ids
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue