[−][src]Trait tantivy::DocSet
Represents an iterable set of sorted doc ids.
Required methods
fn advance(&mut self) -> DocId
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.
fn doc(&self) -> DocId
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
.
fn size_hint(&self) -> u32
Returns a best-effort hint of the length of the docset.
Provided methods
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.
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.
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> usize
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, delete_bitset: &DeleteBitSet) -> u32
Returns the number documents matching.
Calling this method consumes the DocSet
.
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
impl<'a> DocSet for &'a mut dyn DocSet
[src]
fn advance(&mut self) -> u32
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn doc(&self) -> u32
[src]
fn size_hint(&self) -> u32
[src]
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> usize
[src]
fn count(&mut self, delete_bitset: &DeleteBitSet) -> u32
[src]
fn count_including_deleted(&mut self) -> u32
[src]
Implementations on Foreign Types
impl<TDocSet: DocSet + ?Sized> DocSet for Box<TDocSet>
[src]
fn advance(&mut self) -> DocId
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn doc(&self) -> DocId
[src]
fn size_hint(&self) -> u32
[src]
fn count(&mut self, delete_bitset: &DeleteBitSet) -> u32
[src]
fn count_including_deleted(&mut self) -> u32
[src]
Implementors
impl DocSet for SegmentPostings
[src]
fn advance(&mut self) -> DocId
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn doc(&self) -> DocId
[src]
Return the current document's DocId
.
fn size_hint(&self) -> u32
[src]
impl DocSet for AllScorer
[src]
impl DocSet for BitSetDocSet
[src]
fn advance(&mut self) -> DocId
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn doc(&self) -> DocId
[src]
Returns the current document
fn size_hint(&self) -> u32
[src]
Returns half of the max_doc
This is quite a terrible heuristic,
but we don't have access to any better
value.
impl DocSet for EmptyScorer
[src]
impl<'a> DocSet for &'a mut dyn DocSet
[src]
fn advance(&mut self) -> u32
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn doc(&self) -> u32
[src]
fn size_hint(&self) -> u32
[src]
impl<TDocSet, TDocSetExclude> DocSet for Exclude<TDocSet, TDocSetExclude> where
TDocSet: DocSet,
TDocSetExclude: DocSet,
[src]
TDocSet: DocSet,
TDocSetExclude: DocSet,
fn advance(&mut self) -> DocId
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn doc(&self) -> DocId
[src]
fn size_hint(&self) -> u32
[src]
.size_hint()
directly returns the size
of the underlying docset without taking in account
the fact that docs might be deleted.
impl<TDocSet: DocSet> DocSet for ConstScorer<TDocSet>
[src]
fn advance(&mut self) -> DocId
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> usize
[src]
fn doc(&self) -> DocId
[src]
fn size_hint(&self) -> u32
[src]
impl<TDocSet: DocSet, TOtherDocSet: DocSet> DocSet for Intersection<TDocSet, TOtherDocSet>
[src]
fn advance(&mut self) -> DocId
[src]
fn seek(&mut self, target: DocId) -> DocId
[src]
fn doc(&self) -> DocId
[src]
fn size_hint(&self) -> u32
[src]
impl<TReqScorer, TOptScorer, TScoreCombiner> DocSet for RequiredOptionalScorer<TReqScorer, TOptScorer, TScoreCombiner> where
TReqScorer: DocSet,
TOptScorer: DocSet,
[src]
TReqScorer: DocSet,
TOptScorer: DocSet,
impl<TScorer, TScoreCombiner> DocSet for Union<TScorer, TScoreCombiner> where
TScorer: Scorer,
TScoreCombiner: ScoreCombiner,
[src]
TScorer: Scorer,
TScoreCombiner: ScoreCombiner,