pub trait DocSet: Send {
fn advance(&mut self) -> DocId;
fn doc(&self) -> DocId;
fn size_hint(&self) -> u32;
fn seek(&mut self, target: DocId) -> DocId { ... }
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> usize { ... }
fn count(&mut self, alive_bitset: &AliveBitSet) -> u32 { ... }
fn count_including_deleted(&mut self) -> u32 { ... }
}
Expand description
Represents an iterable set of sorted doc ids.
Required Methods
Goes to the next element.
The DocId of the next element is returned. In other words we should always have :
let doc = docset.advance();
assert_eq!(doc, docset.doc());
If we reached the end of the DocSet, TERMINATED should be returned.
Calling .advance()
on a terminated DocSet should be supported, and TERMINATED should
be returned.
TODO Test existing docsets.
Returns the current document Right after creating a new DocSet, the docset points to the first document.
If the DocSet is empty, .doc() should return TERMINATED
.
Provided Methods
Advances the DocSet forward until reaching the target, or going to the lowest DocId greater than the target.
If the end of the DocSet is reached, TERMINATED is returned.
Calling .seek(target)
on a terminated DocSet is legal. Implementation
of DocSet should support it.
Calling seek(TERMINATED)
is also legal and is the normal way to consume a DocSet.
Fills a given mutable buffer with the next doc ids from the
DocSet
If that many DocId
s are available, the method should
fill the entire buffer and return the length of the buffer.
If we reach the end of the DocSet
before filling
it entirely, then the buffer is filled up to this point, and
return value is the number of elements that were filled.
Warning
This method is only here for specific high-performance
use case where batching. The normal way to
go through the DocId
’s is to call .advance()
.
fn count(&mut self, alive_bitset: &AliveBitSet) -> u32
fn count(&mut self, alive_bitset: &AliveBitSet) -> u32
Returns the number documents matching.
Calling this method consumes the DocSet
.
fn count_including_deleted(&mut self) -> u32
fn count_including_deleted(&mut self) -> u32
Returns the count of documents, deleted or not.
Calling this method consumes the DocSet
.
Of course, the result is an upper bound of the result
given by count()
.
Trait Implementations
sourceimpl<'a> DocSet for &'a mut dyn DocSet
impl<'a> DocSet for &'a mut dyn DocSet
sourcefn seek(&mut self, target: DocId) -> DocId
fn seek(&mut self, target: DocId) -> DocId
Advances the DocSet forward until reaching the target, or going to the lowest DocId greater than the target. Read more
sourcefn doc(&self) -> u32
fn doc(&self) -> u32
Returns the current document Right after creating a new DocSet, the docset points to the first document. Read more
sourcefn count(&mut self, alive_bitset: &AliveBitSet) -> u32
fn count(&mut self, alive_bitset: &AliveBitSet) -> u32
Returns the number documents matching.
Calling this method consumes the DocSet
. Read more
sourcefn count_including_deleted(&mut self) -> u32
fn count_including_deleted(&mut self) -> u32
Returns the count of documents, deleted or not.
Calling this method consumes the DocSet
. Read more