[−][src]Trait tantivy::DocSet
Represents an iterable set of sorted doc ids.
Required methods
fn advance(&mut self) -> bool
Goes to the next element.
.advance(...)
needs to be called a first time to point to the correct
element.
fn doc(&self) -> DocId
Returns the current document
fn size_hint(&self) -> u32
Returns a best-effort hint of the length of the docset.
Provided methods
fn skip_next(&mut self, target: DocId) -> SkipResult
After skipping, position the iterator in such a way that .doc()
will return a value greater than or equal to target.
SkipResult expresses whether the target value
was reached, overstepped,
or if the DocSet
was entirely consumed without finding any value
greater or equal to the target
.
WARNING: Calling skip always advances the docset. More specifically, if the docset is already positionned on the target skipping will advance to the next position and return SkipResult::Overstep.
If .skip_next()
oversteps, then the docset must be positionned correctly
on an existing document. In other words, .doc()
should return the first document
greater than DocId
.
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 append_to_bitset(&mut self, bitset: &mut BitSet)
Appends all docs to a bitset
.
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()
.
Implementations on Foreign Types
impl<TDocSet: DocSet + ?Sized> DocSet for Box<TDocSet>
[src]
fn advance(&mut self) -> bool
[src]
fn skip_next(&mut self, target: DocId) -> SkipResult
[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]
fn append_to_bitset(&mut self, bitset: &mut BitSet)
[src]
Implementors
impl DocSet for SegmentPostings
[src]
fn advance(&mut self) -> bool
[src]
fn skip_next(&mut self, target: DocId) -> SkipResult
[src]
fn doc(&self) -> DocId
[src]
Return the current document's DocId
.
Panics
Will panics if called without having called advance before.
fn size_hint(&self) -> u32
[src]
fn append_to_bitset(&mut self, bitset: &mut BitSet)
[src]
impl DocSet for AllScorer
[src]
impl DocSet for BitSetDocSet
[src]
fn advance(&mut self) -> bool
[src]
fn skip_next(&mut self, target: DocId) -> SkipResult
[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<TDocSet, TDocSetExclude> DocSet for Exclude<TDocSet, TDocSetExclude> where
TDocSet: DocSet,
TDocSetExclude: DocSet,
[src]
TDocSet: DocSet,
TDocSetExclude: DocSet,
fn advance(&mut self) -> bool
[src]
fn skip_next(&mut self, target: DocId) -> SkipResult
[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) -> bool
[src]
fn skip_next(&mut self, target: DocId) -> SkipResult
[src]
fn fill_buffer(&mut self, buffer: &mut [DocId]) -> usize
[src]
fn doc(&self) -> DocId
[src]
fn size_hint(&self) -> u32
[src]
fn append_to_bitset(&mut self, bitset: &mut BitSet)
[src]
impl<TDocSet: DocSet, TOtherDocSet: DocSet> DocSet for Intersection<TDocSet, TOtherDocSet>
[src]
fn advance(&mut self) -> bool
[src]
fn skip_next(&mut self, target: DocId) -> SkipResult
[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,