[Zope-CVS] CVS: Products/ZCTextIndex - OkapiIndex.py:1.1.2.6

Guido van Rossum guido@python.org
Tue, 14 May 2002 11:07:49 -0400


Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv8975

Modified Files:
      Tag: TextIndexDS9-branch
	OkapiIndex.py 
Log Message:
_union() and _intersection() would croak on an empty L.


=== Products/ZCTextIndex/OkapiIndex.py 1.1.2.5 => 1.1.2.6 ===
 
     def _intersection(self, L):
+        if not L:
+            return IIBTree()
         # Intersect with smallest first.
         L = L[:]    # don't mutate the caller's L
         L.sort(lambda x, y: cmp(len(x[0]), len(y[0])))
@@ -167,6 +169,8 @@
         return result
 
     def _union(self, L):
+        if not L:
+            return IIBTree()
         # Balance unions as closely as possible, smallest to largest.
         merge = NBest(len(L))
         for x, weight in L: