Struct tantivy::collector::TopCollector
[−]
[src]
pub struct TopCollector { /* fields omitted */ }
The Top Collector keeps track of the K documents with the best scores.
The implementation is based on a BinaryHeap
.
The theorical complexity is O(n log K)
.
Methods
impl TopCollector
[src]
pub fn with_limit(limit: usize) -> TopCollector
[src]
Creates a top collector, with a number of documents equal to "limit".
Panics
The method panics if limit is 0
pub fn docs(&self) -> Vec<DocAddress>
[src]
Returns K best documents sorted in decreasing order.
Calling this method triggers the sort. The result of the sort is not cached.
pub fn score_docs(&self) -> Vec<(Score, DocAddress)>
[src]
Returns K best ScoredDocument sorted in decreasing order.
Calling this method triggers the sort. The result of the sort is not cached.
pub fn at_capacity(&self) -> bool
[src]
Return true iff at least K documents have gone through the collector.
Trait Implementations
impl Collector for TopCollector
[src]
fn set_segment(
&mut self,
segment_id: SegmentLocalId,
_: &SegmentReader
) -> Result<()>
[src]
&mut self,
segment_id: SegmentLocalId,
_: &SegmentReader
) -> Result<()>
set_segment
is called before beginning to enumerate on this segment. Read more
fn collect(&mut self, doc: DocId, score: Score)
[src]
The query pushes the scored document to the collector via this method.