Skip to main content

Descriptor

Struct Descriptor 

Source
pub struct Descriptor {
    pub dim: u32,
    pub dtype: Dtype,
    pub metric: DistanceMetric,
    pub index: IndexSpec,
    pub filterable: Vec<FilterableField>,
    pub multivector: bool,
    pub vector_encryption: VectorEncryption,
}
Expand description

The immutable schema of a collection, fixed at creation.

Fields§

§dim: u32

Vector dimensionality.

§dtype: Dtype

Vector element type.

§metric: DistanceMetric

Distance metric used for search.

§index: IndexSpec

Index & quantization configuration. Defaults to HNSW/exact and is absent in descriptors written before Phase 2 (filled by the default on read).

§filterable: Vec<FilterableField>

Payload fields indexed for filtering. Empty by default and absent in descriptors written before secondary indexes existed (defaulted on read).

§multivector: bool

Whether this is a multi-vector (late-interaction / ColBERT) collection: each document is stored as a group of token-vector rows and searched by MaxSim (ADR-0028). false for an ordinary single-vector collection, and absent in descriptors written before late interaction existed (defaulted to false on read).

§vector_encryption: VectorEncryption

How this collection’s vectors are encrypted (ADR-0031, ADR-0032). VectorEncryption::None by default; Dcpe requires the L2 metric. Absent in descriptors written before the flag existed (defaulted to None on read); a descriptor written while the flag was a bool encrypted_vectors decodes unchanged (falseNone, trueDcpe).

Implementations§

Source§

impl Descriptor

Source

pub fn new(dim: u32, dtype: Dtype, metric: DistanceMetric) -> Descriptor

A descriptor with the default index (in-memory HNSW, exact) and no filterable fields.

Source

pub fn with_index(self, index: IndexSpec) -> Descriptor

Set the index specification (builder style).

Source

pub fn with_filterable(self, filterable: Vec<FilterableField>) -> Descriptor

Set the filterable payload fields (builder style).

Source

pub fn with_multivector(self, multivector: bool) -> Descriptor

Mark this collection as multi-vector (late-interaction / ColBERT), so each document is stored as a group of token-vector rows scored by MaxSim (builder style). The dimensionality is the per-token dimension.

Source

pub fn with_vector_encryption( self, vector_encryption: VectorEncryption, ) -> Descriptor

Set how this collection’s vectors are encrypted (builder style). A Dcpe collection must use the L2 metric; a ClientSide collection is searched by the client, not the server (ADR-0031, ADR-0032).

Source

pub fn decode(bytes: &[u8]) -> Result<Descriptor, Error>

Decode a descriptor from its postcard bytes, tolerating every earlier layout.

postcard is non-self-describing, so a missing trailing field cannot be defaulted by #[serde(default)] alone (the reader hits end-of-input and errors). We therefore try the layouts newest-to-oldest — current (with vector_encryption) → the six-field multivector layout → the five-field filterable layout → the four-field index-only layout → the original three-field layout — defaulting the missing trailing fields. The order matters: postcard ignores trailing bytes, so an older decoder would silently mis-read a newer buffer if tried first.

§Errors

Returns the postcard error if the bytes match no known layout.

Source

pub fn stride(&self) -> usize

Byte length of one stored vector (dim × element_size).

Trait Implementations§

Source§

impl Clone for Descriptor

Source§

fn clone(&self) -> Descriptor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Descriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Descriptor

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Descriptor, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Descriptor

Source§

impl From<DescriptorV2> for Descriptor

Source§

fn from(v: DescriptorV2) -> Descriptor

Converts to this type from the input type.
Source§

impl From<DescriptorV3> for Descriptor

Source§

fn from(v: DescriptorV3) -> Descriptor

Converts to this type from the input type.
Source§

impl From<DescriptorV4> for Descriptor

Source§

fn from(v: DescriptorV4) -> Descriptor

Converts to this type from the input type.
Source§

impl From<LegacyDescriptor> for Descriptor

Source§

fn from(v: LegacyDescriptor) -> Descriptor

Converts to this type from the input type.
Source§

impl PartialEq for Descriptor

Source§

fn eq(&self, other: &Descriptor) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Descriptor

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Descriptor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.