mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add search capability for series and series_index, custom and non-custom
This commit is contained in:
parent
a14a8b3393
commit
df74c23bda
@ -264,7 +264,11 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
# account for the series index column. Field_metadata knows that
|
# account for the series index column. Field_metadata knows that
|
||||||
# the series index is one larger than the series. If you change
|
# the series index is one larger than the series. If you change
|
||||||
# it here, be sure to change it there as well.
|
# it here, be sure to change it there as well.
|
||||||
self.FIELD_MAP[str(col)+'_s_index'] = base = base+1
|
self.FIELD_MAP[str(col)+'_index'] = base = base+1
|
||||||
|
self.field_metadata.set_field_record_index(
|
||||||
|
self.custom_column_num_map[col]['label']+'_index',
|
||||||
|
base,
|
||||||
|
prefer_custom=True)
|
||||||
|
|
||||||
self.FIELD_MAP['cover'] = base+1
|
self.FIELD_MAP['cover'] = base+1
|
||||||
self.field_metadata.set_field_record_index('cover', base+1, prefer_custom=False)
|
self.field_metadata.set_field_record_index('cover', base+1, prefer_custom=False)
|
||||||
|
@ -36,7 +36,7 @@ class FieldMetadata(dict):
|
|||||||
treated as a single term. If not None, it contains a string, and the field
|
treated as a single term. If not None, it contains a string, and the field
|
||||||
is assumed to contain a list of terms separated by that string
|
is assumed to contain a list of terms separated by that string
|
||||||
|
|
||||||
kind == standard: is a db field.
|
kind == field: is a db field.
|
||||||
kind == category: standard tag category that isn't a field. see news.
|
kind == category: standard tag category that isn't a field. see news.
|
||||||
kind == user: user-defined tag category.
|
kind == user: user-defined tag category.
|
||||||
kind == search: saved-searches category.
|
kind == search: saved-searches category.
|
||||||
@ -239,7 +239,7 @@ class FieldMetadata(dict):
|
|||||||
'is_multiple':None,
|
'is_multiple':None,
|
||||||
'kind':'field',
|
'kind':'field',
|
||||||
'name':None,
|
'name':None,
|
||||||
'search_terms':[],
|
'search_terms':['series_index'],
|
||||||
'is_custom':False,
|
'is_custom':False,
|
||||||
'is_category':False}),
|
'is_category':False}),
|
||||||
('sort', {'table':None,
|
('sort', {'table':None,
|
||||||
@ -395,6 +395,18 @@ class FieldMetadata(dict):
|
|||||||
'is_editable': is_editable,}
|
'is_editable': is_editable,}
|
||||||
self._add_search_terms_to_map(key, [key])
|
self._add_search_terms_to_map(key, [key])
|
||||||
self.custom_label_to_key_map[label] = key
|
self.custom_label_to_key_map[label] = key
|
||||||
|
if datatype == 'series':
|
||||||
|
key += '_index'
|
||||||
|
self._tb_cats[key] = {'table':None, 'column':None,
|
||||||
|
'datatype':'float', 'is_multiple':False,
|
||||||
|
'kind':'field', 'name':'',
|
||||||
|
'search_terms':[key], 'label':label+'_index',
|
||||||
|
'colnum':None, 'display':{},
|
||||||
|
'is_custom':False, 'is_category':False,
|
||||||
|
'link_column':None, 'category_sort':None,
|
||||||
|
'is_editable': False,}
|
||||||
|
self._add_search_terms_to_map(key, [key])
|
||||||
|
self.custom_label_to_key_map[label+'_index'] = key
|
||||||
|
|
||||||
def remove_custom_fields(self):
|
def remove_custom_fields(self):
|
||||||
for key in self.get_custom_fields():
|
for key in self.get_custom_fields():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user