pub struct DirectoryBlock(/* private fields */);Expand description
A metadata block summarizing the posting blocks for a single dimension.
Stores one (max_offset, max_weight) pair per posting block, enabling
block-max pruning: the query engine skips entire posting blocks whose
max_weight * query_weight cannot beat the current top-k threshold.
Serialized as a SparsePostingBlock with bits_per_delta == 0xFF
(the directory sentinel). The body layout is:
body = [ max_offset: u32 LE, max_weight: f32 LE ] × num_entriesThe header’s max_weight stores the dimension-level maximum weight
(max of all per-block max_weights), used for early term pruning.
Implementations§
Source§impl DirectoryBlock
impl DirectoryBlock
Sourcepub fn new(
max_offsets: &[u32],
max_weights: &[f32],
) -> Result<Self, SparsePostingBlockError>
pub fn new( max_offsets: &[u32], max_weights: &[f32], ) -> Result<Self, SparsePostingBlockError>
Create a directory block from per-posting-block metadata.
max_offsets[i]: largest doc offset in posting blockimax_weights[i]: largest weight in posting blocki
Sourcepub fn from_block(block: SparsePostingBlock) -> Result<Self, SparsePostingBlock>
pub fn from_block(block: SparsePostingBlock) -> Result<Self, SparsePostingBlock>
Interpret a SparsePostingBlock as a directory block.
Returns Err with the original block if it is not a directory.
Sourcepub fn dim_max_weight(&self) -> f32
pub fn dim_max_weight(&self) -> f32
Dimension-level maximum weight (max of all per-block max_weights).
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Number of posting blocks summarized by this directory.
Sourcepub fn entries(&self) -> (Vec<u32>, Vec<f32>)
pub fn entries(&self) -> (Vec<u32>, Vec<f32>)
Extract (max_offsets, max_weights) — one pair per posting block.
Sourcepub fn into_block(self) -> SparsePostingBlock
pub fn into_block(self) -> SparsePostingBlock
Consume this directory block into its underlying SparsePostingBlock
for storage in the blockstore.
Trait Implementations§
Source§impl Clone for DirectoryBlock
impl Clone for DirectoryBlock
Source§fn clone(&self) -> DirectoryBlock
fn clone(&self) -> DirectoryBlock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DirectoryBlock
impl RefUnwindSafe for DirectoryBlock
impl Send for DirectoryBlock
impl Sync for DirectoryBlock
impl Unpin for DirectoryBlock
impl UnsafeUnpin for DirectoryBlock
impl UnwindSafe for DirectoryBlock
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§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§unsafe fn to_subset_unchecked(&self) -> SS
unsafe 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.