Commits

Matt Chaput committed 66704ae

Removed erroneous KeyError from TopCollector.remove().
Fixes issue #356.

Comments (0)

Files changed (1)

src/whoosh/collectors.py

         negated = 0 - global_docnum
         items = self.items
 
-        # Search through the results for the document and remove it
+        # Remove the document if it's on the list (it may not be since
+        # TopCollector forgets documents that don't make the top N list)
         for i in xrange(len(items)):
             if items[i][1] == negated:
                 items.pop(i)
                 self.minscore = items[0][0] if items else 0
                 return
 
-        # The document wasn't on the list... somebody's confused!
-        raise KeyError(global_docnum)
-
     def results(self):
         # The items are stored (postive score, negative docnum) so the heap
         # keeps the highest scores and lowest docnums, in order from lowest to