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: u32Vector dimensionality.
dtype: DtypeVector element type.
metric: DistanceMetricDistance metric used for search.
index: IndexSpecIndex & 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: boolWhether 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: VectorEncryptionHow 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 (false→None,
true→Dcpe).
Implementations§
Source§impl Descriptor
impl Descriptor
Sourcepub fn new(dim: u32, dtype: Dtype, metric: DistanceMetric) -> Descriptor
pub fn new(dim: u32, dtype: Dtype, metric: DistanceMetric) -> Descriptor
A descriptor with the default index (in-memory HNSW, exact) and no filterable fields.
Sourcepub fn with_index(self, index: IndexSpec) -> Descriptor
pub fn with_index(self, index: IndexSpec) -> Descriptor
Set the index specification (builder style).
Sourcepub fn with_filterable(self, filterable: Vec<FilterableField>) -> Descriptor
pub fn with_filterable(self, filterable: Vec<FilterableField>) -> Descriptor
Set the filterable payload fields (builder style).
Sourcepub fn with_multivector(self, multivector: bool) -> Descriptor
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.
Sourcepub fn with_vector_encryption(
self,
vector_encryption: VectorEncryption,
) -> Descriptor
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).
Sourcepub fn decode(bytes: &[u8]) -> Result<Descriptor, Error>
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.
Trait Implementations§
Source§impl Clone for Descriptor
impl Clone for Descriptor
Source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Descriptor
impl Debug for Descriptor
Source§impl<'de> Deserialize<'de> for Descriptor
impl<'de> Deserialize<'de> for Descriptor
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Descriptor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Descriptor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Descriptor
Source§impl From<DescriptorV2> for Descriptor
impl From<DescriptorV2> for Descriptor
Source§fn from(v: DescriptorV2) -> Descriptor
fn from(v: DescriptorV2) -> Descriptor
Source§impl From<DescriptorV3> for Descriptor
impl From<DescriptorV3> for Descriptor
Source§fn from(v: DescriptorV3) -> Descriptor
fn from(v: DescriptorV3) -> Descriptor
Source§impl From<DescriptorV4> for Descriptor
impl From<DescriptorV4> for Descriptor
Source§fn from(v: DescriptorV4) -> Descriptor
fn from(v: DescriptorV4) -> Descriptor
Source§impl From<LegacyDescriptor> for Descriptor
impl From<LegacyDescriptor> for Descriptor
Source§fn from(v: LegacyDescriptor) -> Descriptor
fn from(v: LegacyDescriptor) -> Descriptor
Source§impl PartialEq for Descriptor
impl PartialEq for Descriptor
Source§fn eq(&self, other: &Descriptor) -> bool
fn eq(&self, other: &Descriptor) -> bool
self and other values to be equal, and is used by ==.