mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-16 21:49:48 +01:00
newdb: Fix true/false searches on numeric columns
This commit is contained in:
parent
602c3d22a5
commit
8d3fd8b05c
2 changed files with 5 additions and 2 deletions
|
|
@ -290,8 +290,11 @@ def __call__(self, query, field_iter, location, datatype, candidates, is_many=Fa
|
|||
raise ParseException(
|
||||
_('Non-numeric value in query: {0}').format(query))
|
||||
|
||||
qfalse = query == 'false'
|
||||
for val, book_ids in field_iter():
|
||||
if val is None:
|
||||
if qfalse:
|
||||
matches |= book_ids
|
||||
continue
|
||||
try:
|
||||
v = cast(val)
|
||||
|
|
|
|||
|
|
@ -224,8 +224,8 @@ def test_searching(self): # {{{
|
|||
'rating:3', 'rating:>2', 'rating:=2', 'rating:true',
|
||||
'rating:false', 'rating:>4', 'tags:#<2', 'tags:#>7',
|
||||
'cover:false', 'cover:true', '#float:>11', '#float:<1k',
|
||||
'#float:10.01', 'series_index:1', 'series_index:<3', 'id:1',
|
||||
'id:>2',
|
||||
'#float:10.01', '#float:false', 'series_index:1',
|
||||
'series_index:<3', 'id:1', 'id:>2',
|
||||
|
||||
# Bool tests
|
||||
'#yesno:true', '#yesno:false', '#yesno:yes', '#yesno:no',
|
||||
|
|
|
|||
Loading…
Reference in a new issue