diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 83c56c5395..e2ecdd9f55 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -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):