Struct tantivy::collector::HistogramCollector
source · pub struct HistogramCollector { /* private fields */ }
Expand description
Histogram builds an histogram of the values of a fastfield for the collected DocSet.
At construction, it is given parameters that define a partition of an interval
[min_val, max_val) into N buckets with the same width.
The ith bucket is then defined by [min_val + i * bucket_width, min_val + (i+1) * bucket_width)
An histogram is then defined as a Vec<u64>
of length num_buckets
, that contains a count of
documents for each value bucket.
See also HistogramCollector::new()
.
§Warning
f64 fields are not supported.
Implementations§
source§impl HistogramCollector
impl HistogramCollector
sourcepub fn new<TFastValue: FastValue>(
field: String,
min_value: TFastValue,
bucket_width: u64,
num_buckets: usize
) -> HistogramCollector
pub fn new<TFastValue: FastValue>( field: String, min_value: TFastValue, bucket_width: u64, num_buckets: usize ) -> HistogramCollector
Builds a new HistogramCollector.
The scale/range of the histogram is not dynamic. It is required to define it by supplying following parameter:
min_value
: the minimum value that can be recorded in the histogram.bucket_width
: the length of the interval that is associated with each buckets.num_buckets
: The overall number of buckets.
Together, this parameters define a partition of [min_value, min_value + num_buckets * bucket_width)
into num_buckets
intervals of width bucket that we call bucket
.
§Disclaimer
This function panics if the field given is of type f64.
Trait Implementations§
source§impl Clone for HistogramCollector
impl Clone for HistogramCollector
source§fn clone(&self) -> HistogramCollector
fn clone(&self) -> HistogramCollector
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Collector for HistogramCollector
impl Collector for HistogramCollector
§type Fruit = Vec<u64>
type Fruit = Vec<u64>
Fruit
is the type for the result of our collection.
e.g. usize
for the Count
collector.source§fn for_segment(
&self,
_segment_local_id: SegmentOrdinal,
segment: &SegmentReader
) -> Result<Self::Child>
fn for_segment( &self, _segment_local_id: SegmentOrdinal, segment: &SegmentReader ) -> Result<Self::Child>
set_segment
is called before beginning to enumerate
on this segment.source§fn requires_scoring(&self) -> bool
fn requires_scoring(&self) -> bool
source§fn merge_fruits(&self, child_histograms: Vec<Vec<u64>>) -> Result<Vec<u64>>
fn merge_fruits(&self, child_histograms: Vec<Vec<u64>>) -> Result<Vec<u64>>
source§fn collect_segment(
&self,
weight: &dyn Weight,
segment_ord: u32,
reader: &SegmentReader
) -> Result<<Self::Child as SegmentCollector>::Fruit>
fn collect_segment( &self, weight: &dyn Weight, segment_ord: u32, reader: &SegmentReader ) -> Result<<Self::Child as SegmentCollector>::Fruit>
Auto Trait Implementations§
impl Freeze for HistogramCollector
impl RefUnwindSafe for HistogramCollector
impl Send for HistogramCollector
impl Sync for HistogramCollector
impl Unpin for HistogramCollector
impl UnwindSafe for HistogramCollector
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.