Trait tantivy::collector::Collector [−][src]
Collectors are in charge of collecting and retaining relevant information from the document found and scored by the query.
For instance,
- keeping track of the top 10 best documents
- computing a breakdown over a fast field
- computing the number of documents matching the query
Our search index is in fact a collection of segments, so
a Collector
trait is actually more of a factory to instance
SegmentCollector
s for each segments.
The collection logic itself is in the SegmentCollector
.
Segments are not guaranteed to be visited in any specific order.
Associated Types
type Fruit: Fruit
[src]
Fruit
is the type for the result of our collection.
e.g. usize
for the Count
collector.
type Child: SegmentCollector
[src]
Type of the SegmentCollector
associated to this collector.
Required methods
fn for_segment(
&self,
segment_local_id: SegmentLocalId,
segment: &SegmentReader
) -> Result<Self::Child>
[src]
&self,
segment_local_id: SegmentLocalId,
segment: &SegmentReader
) -> Result<Self::Child>
set_segment
is called before beginning to enumerate
on this segment.
fn requires_scoring(&self) -> bool
[src]
Returns true iff the collector requires to compute scores for documents.
fn merge_fruits(
&self,
segment_fruits: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<Self::Fruit>
[src]
&self,
segment_fruits: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<Self::Fruit>
Combines the fruit associated to the collection of each segments into one fruit.
Provided methods
fn collect_segment(
&self,
weight: &dyn Weight,
segment_ord: u32,
reader: &SegmentReader
) -> Result<<Self::Child as SegmentCollector>::Fruit>
[src]
&self,
weight: &dyn Weight,
segment_ord: u32,
reader: &SegmentReader
) -> Result<<Self::Child as SegmentCollector>::Fruit>
Created a segment collector and
Implementations on Foreign Types
impl<Left, Right> Collector for (Left, Right) where
Left: Collector,
Right: Collector,
[src]
Left: Collector,
Right: Collector,
type Fruit = (Left::Fruit, Right::Fruit)
type Child = (Left::Child, Right::Child)
fn for_segment(
&self,
segment_local_id: u32,
segment: &SegmentReader
) -> Result<Self::Child>
[src]
&self,
segment_local_id: u32,
segment: &SegmentReader
) -> Result<Self::Child>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
segment_fruits: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<(Left::Fruit, Right::Fruit)>
[src]
&self,
segment_fruits: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<(Left::Fruit, Right::Fruit)>
impl<One, Two, Three> Collector for (One, Two, Three) where
One: Collector,
Two: Collector,
Three: Collector,
[src]
One: Collector,
Two: Collector,
Three: Collector,
type Fruit = (One::Fruit, Two::Fruit, Three::Fruit)
type Child = (One::Child, Two::Child, Three::Child)
fn for_segment(
&self,
segment_local_id: u32,
segment: &SegmentReader
) -> Result<Self::Child>
[src]
&self,
segment_local_id: u32,
segment: &SegmentReader
) -> Result<Self::Child>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
children: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<Self::Fruit>
[src]
&self,
children: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<Self::Fruit>
impl<One, Two, Three, Four> Collector for (One, Two, Three, Four) where
One: Collector,
Two: Collector,
Three: Collector,
Four: Collector,
[src]
One: Collector,
Two: Collector,
Three: Collector,
Four: Collector,
type Fruit = (One::Fruit, Two::Fruit, Three::Fruit, Four::Fruit)
type Child = (One::Child, Two::Child, Three::Child, Four::Child)
fn for_segment(
&self,
segment_local_id: u32,
segment: &SegmentReader
) -> Result<Self::Child>
[src]
&self,
segment_local_id: u32,
segment: &SegmentReader
) -> Result<Self::Child>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
children: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<Self::Fruit>
[src]
&self,
children: Vec<<Self::Child as SegmentCollector>::Fruit>
) -> Result<Self::Fruit>
Implementors
impl Collector for Count
[src]
type Fruit = usize
type Child = SegmentCountCollector
fn for_segment(
&self,
_: SegmentLocalId,
_: &SegmentReader
) -> Result<SegmentCountCollector>
[src]
&self,
_: SegmentLocalId,
_: &SegmentReader
) -> Result<SegmentCountCollector>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(&self, segment_counts: Vec<usize>) -> Result<usize>
[src]
impl Collector for DocSetCollector
[src]
type Fruit = HashSet<DocAddress>
type Child = DocSetChildCollector
fn for_segment(
&self,
segment_local_id: SegmentLocalId,
_segment: &SegmentReader
) -> Result<Self::Child>
[src]
&self,
segment_local_id: SegmentLocalId,
_segment: &SegmentReader
) -> Result<Self::Child>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
segment_fruits: Vec<(u32, HashSet<DocId>)>
) -> Result<Self::Fruit>
[src]
&self,
segment_fruits: Vec<(u32, HashSet<DocId>)>
) -> Result<Self::Fruit>
impl Collector for FacetCollector
[src]
type Fruit = FacetCounts
type Child = FacetSegmentCollector
fn for_segment(
&self,
_: SegmentLocalId,
reader: &SegmentReader
) -> Result<FacetSegmentCollector>
[src]
&self,
_: SegmentLocalId,
reader: &SegmentReader
) -> Result<FacetSegmentCollector>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
segments_facet_counts: Vec<FacetCounts>
) -> Result<FacetCounts>
[src]
&self,
segments_facet_counts: Vec<FacetCounts>
) -> Result<FacetCounts>
impl Collector for TopDocs
[src]
type Fruit = Vec<(Score, DocAddress)>
type Child = TopScoreSegmentCollector
fn for_segment(
&self,
segment_local_id: SegmentLocalId,
reader: &SegmentReader
) -> Result<Self::Child>
[src]
&self,
segment_local_id: SegmentLocalId,
reader: &SegmentReader
) -> Result<Self::Child>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
child_fruits: Vec<Vec<(Score, DocAddress)>>
) -> Result<Self::Fruit>
[src]
&self,
child_fruits: Vec<Vec<(Score, DocAddress)>>
) -> Result<Self::Fruit>
fn collect_segment(
&self,
weight: &dyn Weight,
segment_ord: u32,
reader: &SegmentReader
) -> Result<<Self::Child as SegmentCollector>::Fruit>
[src]
&self,
weight: &dyn Weight,
segment_ord: u32,
reader: &SegmentReader
) -> Result<<Self::Child as SegmentCollector>::Fruit>
impl<'a> Collector for MultiCollector<'a>
[src]
type Fruit = MultiFruit
type Child = MultiCollectorChild
fn for_segment(
&self,
segment_local_id: SegmentLocalId,
segment: &SegmentReader
) -> Result<MultiCollectorChild>
[src]
&self,
segment_local_id: SegmentLocalId,
segment: &SegmentReader
) -> Result<MultiCollectorChild>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
segments_multifruits: Vec<MultiFruit>
) -> Result<MultiFruit>
[src]
&self,
segments_multifruits: Vec<MultiFruit>
) -> Result<MultiFruit>
impl<TCollector, TPredicate, TPredicateValue: FastValue> Collector for FilterCollector<TCollector, TPredicate, TPredicateValue> where
TCollector: Collector + Send + Sync,
TPredicate: 'static + Fn(TPredicateValue) -> bool + Send + Sync,
TPredicateValue: 'static + FastValue,
[src]
TCollector: Collector + Send + Sync,
TPredicate: 'static + Fn(TPredicateValue) -> bool + Send + Sync,
TPredicateValue: 'static + FastValue,
type Fruit = TCollector::Fruit
type Child = FilterSegmentCollector<TCollector::Child, TPredicate, TPredicateValue>
fn for_segment(
&self,
segment_local_id: u32,
segment_reader: &SegmentReader
) -> Result<FilterSegmentCollector<TCollector::Child, TPredicate, TPredicateValue>>
[src]
&self,
segment_local_id: u32,
segment_reader: &SegmentReader
) -> Result<FilterSegmentCollector<TCollector::Child, TPredicate, TPredicateValue>>
fn requires_scoring(&self) -> bool
[src]
fn merge_fruits(
&self,
segment_fruits: Vec<<TCollector::Child as SegmentCollector>::Fruit>
) -> Result<TCollector::Fruit>
[src]
&self,
segment_fruits: Vec<<TCollector::Child as SegmentCollector>::Fruit>
) -> Result<TCollector::Fruit>