mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix bareword searches trying to match against non-text types.
This commit is contained in:
parent
149f979409
commit
3d38872b56
@ -381,12 +381,17 @@ class ResultCache(SearchQueryParser):
|
||||
location += 's'
|
||||
|
||||
MAP = {}
|
||||
# Fields not used when matching against text contents. These are
|
||||
# the non-text fields
|
||||
EXCLUDE_FIELDS = []
|
||||
|
||||
# get the db columns for the standard searchables
|
||||
for x in self.tag_browser_categories:
|
||||
if (len(self.tag_browser_categories[x]['search_labels']) and \
|
||||
self.tag_browser_categories[x]['kind'] in ['standard', 'not_cat']):
|
||||
MAP[x] = self.FIELD_MAP[self.tag_browser_categories.get_field_label(x)]
|
||||
if self.tag_browser_categories[x]['datatype'] != 'text':
|
||||
EXCLUDE_FIELDS.append(MAP[x])
|
||||
|
||||
# add custom columns to MAP. Put the column's type into IS_CUSTOM
|
||||
IS_CUSTOM = []
|
||||
@ -399,8 +404,6 @@ class ResultCache(SearchQueryParser):
|
||||
MAP[x] = self.FIELD_MAP[self.tag_browser_categories[x]['colnum']]
|
||||
IS_CUSTOM[MAP[x]] = self.tag_browser_categories[x]['datatype']
|
||||
|
||||
# Some fields not used when matching against contents
|
||||
EXCLUDE_FIELDS = [MAP['rating'], MAP['cover']]
|
||||
SPLITABLE_FIELDS = [MAP['authors'], MAP['tags'], MAP['formats']]
|
||||
for x in self.tag_browser_categories.get_custom_fields():
|
||||
if self.tag_browser_categories[x]['is_multiple']:
|
||||
|
@ -36,7 +36,7 @@ class TagsMetadata(dict, DictMixin):
|
||||
'kind':'standard', 'name':_('Authors'),
|
||||
'search_labels':['authors', 'author']}),
|
||||
('series', {'table':'series', 'column':'name',
|
||||
'datatype':None, 'is_multiple':False,
|
||||
'datatype':'text', 'is_multiple':False,
|
||||
'kind':'standard', 'name':_('Series'),
|
||||
'search_labels':['series']}),
|
||||
('formats', {'table':None, 'column':None,
|
||||
@ -60,30 +60,34 @@ class TagsMetadata(dict, DictMixin):
|
||||
'kind':'standard', 'name':_('Tags'),
|
||||
'search_labels':['tags', 'tag']}),
|
||||
('comments', {'table':None, 'column':None,
|
||||
'datatype':None, 'is_multiple':False,
|
||||
'datatype':'text', 'is_multiple':False,
|
||||
'kind':'not_cat', 'name':None,
|
||||
'search_labels':['comments', 'comment']}),
|
||||
('cover', {'table':None, 'column':None,
|
||||
'datatype':None, 'is_multiple':False,
|
||||
'kind':'not_cat', 'name':None,
|
||||
'search_labels':['cover']}),
|
||||
('timestamp', {'table':None, 'column':None,
|
||||
'datatype':'datetime', 'is_multiple':False,
|
||||
'kind':'not_cat', 'name':None,
|
||||
'search_labels':['date']}),
|
||||
('isbn', {'table':None, 'column':None,
|
||||
'datatype':None, 'is_multiple':False,
|
||||
'datatype':'text', 'is_multiple':False,
|
||||
'kind':'not_cat', 'name':None,
|
||||
'search_labels':['isbn']}),
|
||||
('pubdate', {'table':None, 'column':None,
|
||||
'datatype':None, 'is_multiple':False,
|
||||
'datatype':'datetime', 'is_multiple':False,
|
||||
'kind':'not_cat', 'name':None,
|
||||
'search_labels':['pubdate']}),
|
||||
('title', {'table':None, 'column':None,
|
||||
'datatype':None, 'is_multiple':False,
|
||||
'datatype':'text', 'is_multiple':False,
|
||||
'kind':'not_cat', 'name':None,
|
||||
'search_labels':['title']}),
|
||||
]
|
||||
|
||||
# search labels that are not db columns
|
||||
search_items = [ 'all',
|
||||
'date',
|
||||
# 'date',
|
||||
'search',
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user