1. Matt Chaput
  2. whoosh

Commits

Matt Chaput  committed b8ecb66

Fixed a bug in FilePostingReader.
The all_ids() method doesn't set self.blockinfo as it goes, but _read_ids() and
_read_weights() were looking in self.blockinfo for the compressed lengths, so I had to
add the compressed lengths as arguments to the read functions.

  • Participants
  • Parent commits c05f35b
  • Branches default

Comments (0)

Files changed (1)

File src/whoosh/filedb/filepostings.py

View file
  • Ignore whitespace
         for _ in xrange(self.blockcount):
             blockinfo = self._read_blockinfo(nextoffset)
             nextoffset = blockinfo.nextoffset
-            ids, __ = self._read_ids(blockinfo.dataoffset, blockinfo.postcount)
+            ids, __ = self._read_ids(blockinfo.dataoffset, blockinfo.postcount,
+                                     blockinfo.idslen)
             for id in ids:
                 yield id
 
         pf.seek(offset)
         return BlockInfo.from_file(pf, self.stringids)
         
-    def _read_ids(self, offset, postcount):
+    def _read_ids(self, offset, postcount, idslen):
         pf = self.postfile
         pf.seek(offset)
-        idslen = self.blockinfo.idslen
         
         if self.stringids:
             rs = pf.read_string
 
         return (ids, newoffset)
 
-    def _read_weights(self, offset, postcount):
-        weightslen = self.blockinfo.weightslen
-        
+    def _read_weights(self, offset, postcount, weightslen):
         if weightslen:
             weights = array("f")
             weights.fromstring(decompress(self.postfile.read(weightslen)))
 
     def _consume_block(self):
         postcount = self.blockinfo.postcount
-        self.ids, woffset = self._read_ids(self.blockinfo.dataoffset, postcount)
-        self.weights, voffset = self._read_weights(woffset, postcount)
+        self.ids, woffset = self._read_ids(self.blockinfo.dataoffset, postcount,
+                                           self.blockinfo.idslen)
+        self.weights, voffset = self._read_weights(woffset, postcount,
+                                                   self.blockinfo.weightslen)
         self.voffset = voffset
         self.values = None
         self.i = 0