예제 #1
0
        def __init__(self, dbfile, basepos, length, doccount):
            self._dbfile = dbfile
            self._basepos = basepos
            self._length = length
            self._doccount = doccount

            compressed = dbfile.get_byte(basepos + (length - 1))
            if compressed:
                bbytes = zlib.decompress(dbfile.get(basepos, length - 1))
                bitset = BitSet.from_bytes(bbytes)
            else:
                dbfile.seek(basepos)
                bitset = OnDiskBitSet(dbfile, basepos, length - 1)
            self._bitset = bitset
예제 #2
0
        def __init__(self, dbfile, basepos, length, doccount):
            self._dbfile = dbfile
            self._basepos = basepos
            self._length = length
            self._doccount = doccount

            compressed = dbfile.get_byte(basepos + (length - 1))
            if compressed:
                bbytes = zlib.decompress(dbfile.get(basepos, length - 1))
                bitset = BitSet.from_bytes(bbytes)
            else:
                dbfile.seek(basepos)
                bitset = OnDiskBitSet(dbfile, basepos, length - 1)
            self._bitset = bitset
 def load(self):
     if isinstance(self._bitset, OnDiskBitSet):
         bs = self._dbfile.get_array(self._basepos, "B",
                                     self._length - 1)
         self._bitset = BitSet.from_bytes(bs)
     return self
예제 #4
0
 def load(self):
     if isinstance(self._bitset, OnDiskBitSet):
         bs = self._dbfile.get_array(self._basepos, "B",
                                     self._length - 1)
         self._bitset = BitSet.from_bytes(bs)
     return self