pub struct Schema {
pub defaults: ValueTypes,
pub keys: HashMap<String, ValueTypes>,
}Expand description
Schema representation for collection index configurations
This represents the server-side schema structure used for index management
Fields§
§defaults: ValueTypesDefault index configurations for each value type
keys: HashMap<String, ValueTypes>Key-specific index overrides TODO(Sanket): Needed for backwards compatibility. Should remove after deploy.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn new_default(default_knn_index: KnnIndex) -> Self
pub fn new_default(default_knn_index: KnnIndex) -> Self
Create a new Schema with strongly-typed default configurations
pub fn get_internal_spann_config(&self) -> Option<InternalSpannConfiguration>
Sourcepub fn reconcile_with_defaults(
user_schema: Option<Schema>,
) -> Result<Self, String>
pub fn reconcile_with_defaults( user_schema: Option<Schema>, ) -> Result<Self, String>
Reconcile user-provided schema with system defaults
This method merges user configurations with system defaults, ensuring that:
- User overrides take precedence over defaults
- Missing user configurations fall back to system defaults
- Field-level merging for complex configurations (Vector, HNSW, SPANN, etc.)
Sourcepub fn merge(&self, other: &Schema) -> Result<Schema, SchemaError>
pub fn merge(&self, other: &Schema) -> Result<Schema, SchemaError>
Merge two schemas together, combining key overrides when possible.
Sourcepub fn reconcile_with_collection_config(
schema: Schema,
collection_config: InternalCollectionConfiguration,
) -> Result<Schema, String>
pub fn reconcile_with_collection_config( schema: Schema, collection_config: InternalCollectionConfiguration, ) -> Result<Schema, String>
Reconcile Schema with InternalCollectionConfiguration
Simple reconciliation logic:
- If collection config is default → return schema (schema is source of truth)
- If collection config is non-default and schema is non-default → error (both set)
- If collection config is non-default and schema is default → override schema with collection config
pub fn reconcile_schema_and_config( schema: Option<Schema>, configuration: Option<InternalCollectionConfiguration>, ) -> Result<Schema, String>
pub fn default_with_embedding_function( embedding_function: EmbeddingFunctionConfiguration, ) -> Schema
Sourcepub fn is_metadata_type_index_enabled(
&self,
key: &str,
value_type: MetadataValueType,
) -> Result<bool, SchemaError>
pub fn is_metadata_type_index_enabled( &self, key: &str, value_type: MetadataValueType, ) -> Result<bool, SchemaError>
Check if a specific metadata key-value should be indexed based on schema configuration
pub fn is_metadata_where_indexing_enabled( &self, where_clause: &Where, ) -> Result<(), FilterValidationError>
pub fn is_knn_key_indexing_enabled( &self, key: &str, query: &QueryVector, ) -> Result<(), FilterValidationError>
pub fn ensure_key_from_metadata( &mut self, key: &str, value_type: MetadataValueType, ) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl TryFrom<&Schema> for InternalCollectionConfiguration
impl TryFrom<&Schema> for InternalCollectionConfiguration
impl StructuralPartialEq for Schema
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.