Struct tantivy::fieldnorm::FieldNormReader [−][src]
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
impl FieldNormReader
[src]
pub fn constant(num_docs: u32, fieldnorm: u32) -> FieldNormReader
[src]
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.
pub fn open(fieldnorm_file: FileSlice) -> Result<Self>
[src]
Opens a field norm reader given its file.
pub fn num_docs(&self) -> u32
[src]
Returns the number of documents in this segment.
pub fn fieldnorm(&self, doc_id: DocId) -> u32
[src]
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 always lower than the actual number of tokens.
The fieldnorm is effectively decoded from the
fieldnorm_id
by doing a simple table lookup.
pub fn fieldnorm_id(&self, doc_id: DocId) -> u8
[src]
Returns the fieldnorm_id
associated to a document.
pub fn id_to_fieldnorm(id: u8) -> u32
[src]
Converts a fieldnorm_id
into a fieldnorm.
pub fn fieldnorm_to_id(fieldnorm: u32) -> u8
[src]
Converts a fieldnorm
into a fieldnorm_id
.
(This function is not injective).
Trait Implementations
impl Clone for FieldNormReader
[src]
fn clone(&self) -> FieldNormReader
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl !RefUnwindSafe for FieldNormReader
[src]
impl Send for FieldNormReader
[src]
impl Sync for FieldNormReader
[src]
impl Unpin for FieldNormReader
[src]
impl !UnwindSafe for FieldNormReader
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T> Fruit for T where
T: Send + Downcast,
[src]
T: Send + Downcast,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,