logo
pub struct FieldNormReader(_);
Expand description

Reads the fieldnorm associated to a document. The fieldnorm represents the length associated to a given Field of a given document.

This metric is important to compute the score of a document : a document having a query word in one its short fields (e.g. title) is likely to be more relevant than in one of its longer field (e.g. body).

tantivy encodes fieldnorm on one byte with some precision loss, using the same scheme as Lucene. Each value is place on a log-scale that takes values from 0 to 255.

A value on this scale is identified by a fieldnorm_id. Apart from compression, this scale also makes it possible to precompute computationally expensive functions of the fieldnorm in a very short array.

Implementations

Creates a FieldNormReader with a constant fieldnorm.

The fieldnorm will be subjected to compression as if it was coming from an array-backed fieldnorm reader.

Opens a field norm reader given its file.

Returns the number of documents in this segment.

Returns the fieldnorm associated to a doc id. The fieldnorm is a value approximating the number of tokens in a given field of the doc_id.

It is imprecise, and equal or lower than the actual number of tokens.

The fieldnorm is effectively decoded from the fieldnorm_id by doing a simple table lookup.

Returns the fieldnorm_id associated to a document.

Converts a fieldnorm_id into a fieldnorm.

Converts a fieldnorm into a fieldnorm_id. (This function is not injective).

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert 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. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.