Enhancement #5717: true and false for dates

This commit is contained in:
Charles Haley 2010-06-06 14:29:38 +01:00
parent 1429832542
commit a8d120c1bb

View File

@ -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):