An implementation of an object that acts like a collection of on/off bits.
whoosh.idsets.
DocIdSet
¶一组正整数的基类,实现内置整数的子集 set
类型与其他与docid相关的方法的接口。
这是内置的可选集实现的超类 set
它的内存效率更高,专门用于存储正整数的排序列表,尽管它们不可避免地会比 set
for most operations since they're pure Python.
after
(i)¶返回后面集合中的下一个整数 i
或者没有。
before
(i)¶返回前面集合中的前一个整数 i
或者没有。
first
()¶返回集合中的第一个(最低)整数。
invert_update
(size)¶更新就地设置以包含范围内的数字 [0 - size)
除了这个集合中的数字。
last
()¶返回集合中的最后一个(最高)整数。
whoosh.idsets.
BaseBitSet
¶whoosh.idsets.
BitSet
(source=None, size=0)¶由位数组支持的一种文档标识集。这也可以用作位数组(例如用于Bloom过滤器)。它比一个大的内置整数集更节省内存,但会为稀疏集浪费内存。
参数: |
|
---|
whoosh.idsets.
OnDiskBitSet
(dbfile, basepos, bytecount)¶由磁盘上的一组位所支持的一种文档标识集。
>>> 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]
参数: |
|
---|
whoosh.idsets.
SortedIntSet
(source=None, typecode='I')¶由整数排序数组支持的docidset。
whoosh.idsets.
MultiIdSet
(idsets, offsets)¶包装多个串行子文档集对象,并将其显示为聚合的只读集。
参数: |
|
---|