From 4bf1a46acd25346272a53e171176640ad181e0bc Mon Sep 17 00:00:00 2001 From: John Schember Date: Wed, 1 Jul 2009 06:42:12 -0400 Subject: [PATCH] Enhance used and empty fields search with :false and :true instead of :none --- src/calibre/library/database2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 651d9788d7..edf0071a20 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -213,7 +213,10 @@ class ResultCache(SearchQueryParser): for item in self._data: if item is None: continue for loc in location: - if (not item[loc] or item[loc] == [] or item[loc] == 0 or item[loc] == '') and query == 'none': + if query == 'false' and (not item[loc] or item[loc].strip() == ''): + matches.add(item[0]) + break + if query == 'true' and (item[loc] and item[loc].strip() != ''): matches.add(item[0]) break if rating_query and item[loc] and loc == MAP['rating'] and rating_query == int(item[loc]):