Skip to main content

encode

Function encode 

Source
pub fn encode(sv: &SparseVector) -> Vec<u8> 
Expand description

Canonical binary form of a SparseVector.

Layout (little-endian, variable length):

[count: u32] [indices: count × u32] [values: count × f32]

Indices and values are stored in separate runs (not interleaved) to match the Arrow Struct{indices: List<UInt32>, values: List<Float32>} lowering and to keep each run contiguous for scoring. Weights are lossless f32; quantization is applied by the storage engine at the postings boundary, not here.