Commits

Matt Chaput committed 646a065

Fixed ListMatcher.max_quality().

Comments (0)

Files changed (1)

src/whoosh/matching/mcore.py

                               self._all_weights)
 
     def replace(self, minquality=0):
-        if not self.is_active() or (minquality
-                                    and self.max_quality() < minquality):
+        if not self.is_active():
+            return NullMatcher()
+        elif minquality and self.max_quality() < minquality:
             return NullMatcher()
         else:
             return self
     def max_quality(self):
         # This matcher treats all postings in the list as one "block", so the
         # block quality is the same as the quality of the entire list
-        return self._scorer.block_quality(self)
+        if self._scorer:
+            return self._scorer.block_quality(self)
+        else:
+            return self.block_max_weight()
 
     def block_quality(self):
         return self._scorer.block_quality(self)