pub struct BlockSparsePostingList {
pub doc_count: u32,
pub blocks: Vec<SparseBlock>,
}Fields§
§doc_count: u32§blocks: Vec<SparseBlock>Implementations§
Source§impl BlockSparsePostingList
impl BlockSparsePostingList
Sourcepub fn from_postings_with_block_size(
postings: &[(DocId, u16, f32)],
weight_quant: WeightQuantization,
block_size: usize,
) -> Result<Self>
pub fn from_postings_with_block_size( postings: &[(DocId, u16, f32)], weight_quant: WeightQuantization, block_size: usize, ) -> Result<Self>
Create from postings with configurable block size
Sourcepub fn from_postings(
postings: &[(DocId, u16, f32)],
weight_quant: WeightQuantization,
) -> Result<Self>
pub fn from_postings( postings: &[(DocId, u16, f32)], weight_quant: WeightQuantization, ) -> Result<Self>
Create from postings with default block size (128)
Sourcepub fn from_postings_with_partition(
postings: &[(DocId, u16, f32)],
weight_quant: WeightQuantization,
partition: &[usize],
) -> Result<Self>
pub fn from_postings_with_partition( postings: &[(DocId, u16, f32)], weight_quant: WeightQuantization, partition: &[usize], ) -> Result<Self>
Create from postings using a pre-computed variable-size partition plan.
partition is a slice of block sizes (e.g., [64, 128, 32, …]) whose
sum must equal postings.len(). Each block size must be ≤ MAX_BLOCK_SIZE.
Produced by optimal_partition().
pub fn doc_count(&self) -> u32
pub fn num_blocks(&self) -> usize
pub fn global_max_weight(&self) -> f32
pub fn block_max_weight(&self, block_idx: usize) -> Option<f32>
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Approximate memory usage in bytes
pub fn iterator(&self) -> BlockSparsePostingIterator<'_>
Sourcepub fn serialize(&self) -> Result<(Vec<u8>, Vec<SparseSkipEntry>)>
pub fn serialize(&self) -> Result<(Vec<u8>, Vec<SparseSkipEntry>)>
Serialize: returns (block_data, skip_entries) separately.
Block data and skip entries are written to different file sections. The caller writes block data first, accumulates skip entries, then writes all skip entries in a contiguous section at the file tail.
pub fn decode_all(&self) -> Vec<(DocId, u16, f32)>
Sourcepub fn merge_with_offsets(lists: &[(&BlockSparsePostingList, u32)]) -> Self
pub fn merge_with_offsets(lists: &[(&BlockSparsePostingList, u32)]) -> Self
Merge multiple posting lists from different segments with doc_id offsets.
This is an optimized O(1) merge that stacks blocks without decode/re-encode. Each posting list’s blocks have their first_doc_id adjusted by the corresponding offset.
§Arguments
lists- Slice of (posting_list, doc_offset) pairs from each segment
§Returns
A new posting list with all blocks concatenated and doc_ids remapped
Trait Implementations§
Source§impl Clone for BlockSparsePostingList
impl Clone for BlockSparsePostingList
Source§fn clone(&self) -> BlockSparsePostingList
fn clone(&self) -> BlockSparsePostingList
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BlockSparsePostingList
impl RefUnwindSafe for BlockSparsePostingList
impl Send for BlockSparsePostingList
impl Sync for BlockSparsePostingList
impl Unpin for BlockSparsePostingList
impl UnwindSafe for BlockSparsePostingList
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> 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.