An implementation of an object that acts like a collection of on/off bits.
Base class for a set of positive integers, implementing a subset of the built-in set type’s interface with extra docid-related methods.
This is a superclass for alternative set implementations to the built-in set which are more memory-efficient and specialized toward storing sorted lists of positive integers, though they will inevitably be slower than set for most operations since they’re pure Python.
x.__init__(...) initializes x; see help(type(x)) for signature
Returns the next integer in the set after i, or None.
Returns the previous integer in the set before i, or None.
Returns the first (lowest) integer in the set.
Updates the set in-place to contain numbers in the range [0 - size) except numbers that are in this set.
Returns the last (highest) integer in the set.
x.__init__(...) initializes x; see help(type(x)) for signature
A DocIdSet backed by an array of bits. This can also be useful as a bit array (e.g. for a Bloom filter). It is much more memory efficient than a large built-in set of integers, but wastes memory for sparse sets.
Parameters: |
|
---|
A DocIdSet backed by an array of bits on disk.
>>> st = RamStorage()
>>> f = st.create_file("test.bin")
>>> bs = BitSet([1, 10, 15, 7, 2])
>>> bytecount = bs.to_disk(f)
>>> f.close()
>>> # ...
>>> f = st.open_file("test.bin")
>>> odbs = OnDiskBitSet(f, bytecount)
>>> list(odbs)
[1, 2, 7, 10, 15]
Parameters: |
|
---|
A DocIdSet backed by a sorted array of integers.
Wraps multiple SERIAL sub-DocIdSet objects and presents them as an aggregated, read-only set.
Parameters: |
|
---|