Skip to main content

build_collection_codec

Function build_collection_codec 

Source
pub fn build_collection_codec(
    quantization: &str,
    vectors: &[(u32, Vec<f32>)],
    dim: usize,
    m: usize,
    ef_construction: usize,
    seed: u64,
) -> Result<Option<CollectionCodec>, VectorError>
Expand description

Build a CollectionCodec from a quantization tag and training vectors.

Returns Ok(None) for unsupported or unrecognised tags (e.g. “sq8”, “pq”, “none”) — those variants use separate per-segment code paths — and for an empty vector set. A vector without dim components fails with VectorError::DimensionMismatch.

Each entry is (id, vector); the index reports id in its results, so it must be the collection’s global vector id.