pub struct FastFieldReader {
pub column_type: FastFieldColumnType,
pub num_docs: u32,
pub multi: bool,
/* private fields */
}Expand description
Reads a single fast-field column from mmap/buffer with O(1) doc_id access.
A column is a sequence of independently-decodable blocks. Fresh segments have one block; merged segments may have multiple (one per source segment).
Zero-copy: all data is borrowed from the underlying mmap / OwnedBytes.
Fields§
§column_type: FastFieldColumnType§num_docs: u32§multi: boolImplementations§
Source§impl FastFieldReader
impl FastFieldReader
Sourcepub fn open(file_data: &OwnedBytes, toc: &FastFieldTocEntry) -> Result<Self>
pub fn open(file_data: &OwnedBytes, toc: &FastFieldTocEntry) -> Result<Self>
Open a blocked column from an OwnedBytes file buffer using a TOC entry.
Sourcepub fn get_u64(&self, doc_id: u32) -> u64
pub fn get_u64(&self, doc_id: u32) -> u64
Get raw u64 value for a doc_id.
Returns FAST_FIELD_MISSING for out-of-range doc_ids and for docs
that were never assigned a value (absent docs).
For text columns, returns the global ordinal (remapped from block-local).
For multi-valued columns, returns the first value (or FAST_FIELD_MISSING if empty).
Sourcepub fn value_range(&self, doc_id: u32) -> (u32, u32)
pub fn value_range(&self, doc_id: u32) -> (u32, u32)
Get the value range for a multi-valued column.
Returns (start_index, end_index) — for single-block columns these are
direct indices; for multi-block, use get_multi_values instead.
Sourcepub fn get_value_at(&self, index: u32) -> u64
pub fn get_value_at(&self, index: u32) -> u64
Get a specific value from the flat value array (multi-value mode).
For single-block columns only. For multi-block, use get_multi_values.
Sourcepub fn get_multi_values(&self, doc_id: u32) -> Vec<u64>
pub fn get_multi_values(&self, doc_id: u32) -> Vec<u64>
Get all values for a multi-valued doc_id. Handles multi-block correctly.
Sourcepub fn for_each_multi_value(
&self,
doc_id: u32,
f: impl FnMut(u64) -> bool,
) -> bool
pub fn for_each_multi_value( &self, doc_id: u32, f: impl FnMut(u64) -> bool, ) -> bool
Iterate multi-values for a doc, calling f for each. Returns true if f ever returns true (short-circuit).
Handles multi-block columns correctly by finding the right block.
Sourcepub fn scan_single_values(&self, f: impl FnMut(u32, u64))
pub fn scan_single_values(&self, f: impl FnMut(u32, u64))
Batch-scan all values in a single-value column, calling f(doc_id, raw_value) for each.
Uses auto_read_batch internally (one codec dispatch per block, not per value),
enabling compiler auto-vectorization for byte-aligned bitpacked columns.
For text columns, returned values are global ordinals (remapped).
For multi-value columns, use for_each_multi_value instead.
Sourcepub fn has_value(&self, doc_id: u32) -> bool
pub fn has_value(&self, doc_id: u32) -> bool
Check if this doc has a value (not FAST_FIELD_MISSING).
For single-value columns, checks the raw sentinel. For multi-value columns, checks if the offset range is non-empty.
Sourcepub fn get_i64(&self, doc_id: u32) -> i64
pub fn get_i64(&self, doc_id: u32) -> i64
Get decoded i64 value (zigzag-decoded).
Returns i64::MIN for absent docs (zigzag_decode of FAST_FIELD_MISSING).
Use has_value to distinguish absent from real values.
Sourcepub fn get_f64(&self, doc_id: u32) -> f64
pub fn get_f64(&self, doc_id: u32) -> f64
Get decoded f64 value (sortable-decoded).
Returns NaN for absent docs (sortable_u64_to_f64(FAST_FIELD_MISSING)).
Use has_value to distinguish absent from real values.
Sourcepub fn get_ordinal(&self, doc_id: u32) -> u64
pub fn get_ordinal(&self, doc_id: u32) -> u64
Get the text ordinal for a doc_id. Returns FAST_FIELD_MISSING if missing.
Sourcepub fn get_text(&self, doc_id: u32) -> Option<&str>
pub fn get_text(&self, doc_id: u32) -> Option<&str>
Get the text string for a doc_id (looks up ordinal in block-local dictionary). Returns None if the doc has no value or ordinal is missing.
Sourcepub fn text_ordinal(&self, text: &str) -> Option<u64>
pub fn text_ordinal(&self, text: &str) -> Option<u64>
Look up text string → global ordinal. Returns None if not found.
Sourcepub fn text_dict(&self) -> Option<&TextDictReader>
pub fn text_dict(&self) -> Option<&TextDictReader>
Access the global text dictionary reader (if this is a text column).
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Number of blocks in this column.
Sourcepub fn blocks(&self) -> &[ColumnBlock]
pub fn blocks(&self) -> &[ColumnBlock]
Access blocks for raw stacking during merge.
Auto Trait Implementations§
impl Freeze for FastFieldReader
impl RefUnwindSafe for FastFieldReader
impl Send for FastFieldReader
impl Sync for FastFieldReader
impl Unpin for FastFieldReader
impl UnwindSafe for FastFieldReader
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.