mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Searching on the size column
This commit is contained in:
commit
985cbb78e3
@ -341,8 +341,15 @@ class ResultCache(SearchQueryParser):
|
|||||||
cast = lambda x : float (x)
|
cast = lambda x : float (x)
|
||||||
adjust = lambda x: x
|
adjust = lambda x: x
|
||||||
|
|
||||||
|
if len(query) > 1:
|
||||||
|
mult = query[-1:].lower()
|
||||||
|
mult = {'k':1024.,'m': 1024.**2, 'g': 1024.**3}.get(mult, 1.0)
|
||||||
|
if mult != 1.0:
|
||||||
|
query = query[:-1]
|
||||||
|
else:
|
||||||
|
mult = 1.0
|
||||||
try:
|
try:
|
||||||
q = cast(query)
|
q = cast(query) * mult
|
||||||
except:
|
except:
|
||||||
return matches
|
return matches
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ class FieldMetadata(dict):
|
|||||||
'is_multiple':None,
|
'is_multiple':None,
|
||||||
'kind':'field',
|
'kind':'field',
|
||||||
'name':None,
|
'name':None,
|
||||||
'search_terms':[],
|
'search_terms':['size'],
|
||||||
'is_custom':False,
|
'is_custom':False,
|
||||||
'is_category':False}),
|
'is_category':False}),
|
||||||
('timestamp', {'table':None,
|
('timestamp', {'table':None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user