pub struct PositionPostingList { /* private fields */ }Expand description
Block-based position posting list with skip list for O(log n) doc_id lookup
Similar to BlockPostingList but stores positions per document. Uses binary search on skip list to find the right block, then linear scan within block.
Implementations§
Source§impl PositionPostingList
impl PositionPostingList
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn from_postings(postings: &[PostingWithPositions]) -> Result<Self>
pub fn from_postings(postings: &[PostingWithPositions]) -> Result<Self>
Build from a list of postings with positions
Sourcepub fn push(&mut self, doc_id: DocId, positions: Vec<u32>)
pub fn push(&mut self, doc_id: DocId, positions: Vec<u32>)
Add a posting with positions (for building - converts to block format on serialize)
pub fn doc_count(&self) -> u32
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get_positions(&self, target_doc_id: DocId) -> Option<Vec<u32>>
pub fn get_positions(&self, target_doc_id: DocId) -> Option<Vec<u32>>
Get positions for a specific document using binary search on skip list
Sourcepub fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>
pub fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>
Serialize to bytes (footer-based: data first).
Format:
[block data: data_len bytes]
[skip entries: N × 12 bytes (base_doc, last_doc, offset)]
[footer: data_len(4) + skip_count(4) + doc_count(4) = 12 bytes]Sourcepub fn deserialize(raw: &[u8]) -> Result<Self>
pub fn deserialize(raw: &[u8]) -> Result<Self>
Deserialize from a byte slice (footer-based format).
Sourcepub fn concatenate_blocks(
sources: &[(PositionPostingList, u32)],
) -> Result<Self>
pub fn concatenate_blocks( sources: &[(PositionPostingList, u32)], ) -> Result<Self>
Concatenate blocks from multiple position lists with doc_id remapping (for merge)
Sourcepub fn concatenate_streaming<W: Write>(
sources: &[(&[u8], u32)],
writer: &mut W,
) -> Result<(u32, usize)>
pub fn concatenate_streaming<W: Write>( sources: &[(&[u8], u32)], writer: &mut W, ) -> Result<(u32, usize)>
Streaming merge: write blocks directly to output writer (bounded memory).
Parses only footer + skip_list from each source (no data copy),
streams block data with patched 8-byte prefixes directly to writer,
then appends merged skip_list + footer.
Memory per term: O(total_blocks × 12) for skip entries only.
Returns (doc_count, bytes_written).
Sourcepub fn iter(&self) -> PositionPostingIterator<'_>
pub fn iter(&self) -> PositionPostingIterator<'_>
Get iterator over all postings (for phrase queries)
Trait Implementations§
Source§impl Clone for PositionPostingList
impl Clone for PositionPostingList
Source§fn clone(&self) -> PositionPostingList
fn clone(&self) -> PositionPostingList
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PositionPostingList
impl Debug for PositionPostingList
Auto Trait Implementations§
impl Freeze for PositionPostingList
impl RefUnwindSafe for PositionPostingList
impl Send for PositionPostingList
impl Sync for PositionPostingList
impl Unpin for PositionPostingList
impl UnwindSafe for PositionPostingList
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.