mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enhancement #5717: true and false for dates
This commit is contained in:
parent
1429832542
commit
a8d120c1bb
@ -241,6 +241,24 @@ class ResultCache(SearchQueryParser):
|
||||
matches = set([])
|
||||
if len(query) < 2:
|
||||
return matches
|
||||
|
||||
if location == 'date':
|
||||
location = 'timestamp'
|
||||
loc = self.field_metadata[location]['rec_index']
|
||||
|
||||
if query == 'false':
|
||||
for item in self._data:
|
||||
if item is None: continue
|
||||
if item[loc] is None or item[loc] == UNDEFINED_DATE:
|
||||
matches.add(item[0])
|
||||
return matches
|
||||
if query == 'true':
|
||||
for item in self._data:
|
||||
if item is None: continue
|
||||
if item[loc] is not None and item[loc] != UNDEFINED_DATE:
|
||||
matches.add(item[0])
|
||||
return matches
|
||||
|
||||
relop = None
|
||||
for k in self.date_search_relops.keys():
|
||||
if query.startswith(k):
|
||||
@ -249,10 +267,6 @@ class ResultCache(SearchQueryParser):
|
||||
if relop is None:
|
||||
(p, relop) = self.date_search_relops['=']
|
||||
|
||||
if location == 'date':
|
||||
location = 'timestamp'
|
||||
loc = self.field_metadata[location]['rec_index']
|
||||
|
||||
if query == _('today'):
|
||||
qd = now()
|
||||
field_count = 3
|
||||
@ -301,7 +315,7 @@ class ResultCache(SearchQueryParser):
|
||||
if query == 'false':
|
||||
query = '0'
|
||||
elif query == 'true':
|
||||
query = '>0'
|
||||
query = '!=0'
|
||||
relop = None
|
||||
for k in self.numeric_search_relops.keys():
|
||||
if query.startswith(k):
|
||||
|
Loading…
x
Reference in New Issue
Block a user