From aad2efc4efe9c08a49fe305e1e7942718d11236d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Tue, 13 Dec 2005 08:42:47 +0000 Subject: [PATCH] * fix: return empty result if no valid terms given --- pisi/search/invertedindex.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pisi/search/invertedindex.py b/pisi/search/invertedindex.py index ea42c952..4f8d4657 100644 --- a/pisi/search/invertedindex.py +++ b/pisi/search/invertedindex.py @@ -39,7 +39,10 @@ class InvertedIndex(object): def query(self, terms, txn = None): def proc(txn): docs = [ self.get_term(x, txn) for x in terms ] - return reduce(lambda x,y: x.intersection(y), docs) + if docs: + return reduce(lambda x,y: x.intersection(y), docs) + else: + return set() return self.d.txn_proc(proc, txn) def list_terms(self, txn= None):