Skip to main content

VectorSettings

Struct VectorSettings 

Source
#[non_exhaustive]
pub struct VectorSettings { /* private fields */ }
Expand description

Settings of one named vector index. dims is required; the rest has safe defaults: brute force, f32 in memory, 1 MiB of text per chunk, 64 meta pairs of at most 256 and 4 096 bytes, 10 000 records per call, keyword queries of 32 terms and 2 000 chars. Built with new(dims).

Implementations§

Source§

impl VectorSettings

Source

pub fn new(dims: usize) -> Self

Starts settings for vectors of dims dimensions. Input: dims, checked in 1..=65 536 when the index opens. Output: settings with every other value at its default.

Source

pub fn with_kind(self, kind: IndexKind) -> Self

Sets the index kind. A kind or HNSW params other than the stored ones rebuild the index and rewrite its pages when it opens. Default IndexKind::BruteForce.

Source

pub fn with_quantization(self, quantization: Quantization) -> Self

Sets the in-memory vector format. The file always keeps f32, so a change only reloads memory. The last vectors call for a name sets it for every handle of that name. Default Quantization::F32.

Source

pub fn with_max_text_bytes(self, bytes: usize) -> Self

Sets the largest chunk text in bytes. A larger record fails the whole call with CoreError::Store. Default 1 MiB.

Source

pub fn with_max_meta_pairs(self, pairs: usize) -> Self

Sets the most meta pairs on one record and in one search filter. More fails the call with CoreError::Store. Default 64.

Source

pub fn with_max_meta_key_bytes(self, bytes: usize) -> Self

Sets the longest meta key in bytes. A longer key fails the call with CoreError::Store. Default 256.

Source

pub fn with_max_meta_value_bytes(self, bytes: usize) -> Self

Sets the longest meta value in bytes. A longer value fails the call with CoreError::Store. Default 4 096.

Source

pub fn with_max_batch(self, records: usize) -> Self

Sets the most records one upsert or replace_source writes, which bounds one transaction. Default 10 000.

Source

pub fn with_max_query_terms(self, terms: usize) -> Self

Sets the most terms in one keyword query, which bounds the FTS5 work per call. More terms fail with CoreError::Store. Default 32.

Source

pub fn with_max_query_chars(self, chars: usize) -> Self

Sets the longest keyword query in chars. A longer query fails with CoreError::Store. Default 2 000.

Source

pub fn dims(&self) -> usize

Returns the dimension of every vector and query. It is fixed per index name once the index exists. Required, no default.

Source

pub fn kind(&self) -> &IndexKind

Returns the index kind. Brute force is exact; HNSW is approximate and faster. Default IndexKind::BruteForce.

Source

pub fn quantization(&self) -> Quantization

Returns the in-memory vector format. The file always keeps f32. Default Quantization::F32.

Source

pub fn max_text_bytes(&self) -> usize

Returns the largest chunk text in bytes. Checked on every record before anything is written. Default 1 MiB.

Source

pub fn max_meta_pairs(&self) -> usize

Returns the most meta pairs per record and per filter. Checked before anything is written or searched. Default 64.

Source

pub fn max_meta_key_bytes(&self) -> usize

Returns the longest meta key in bytes. Checked on every record before anything is written. Default 256.

Source

pub fn max_meta_value_bytes(&self) -> usize

Returns the longest meta value in bytes. Checked on every record before anything is written. Default 4 096.

Source

pub fn max_batch(&self) -> usize

Returns the most records per write call. It bounds one transaction. Default 10 000.

Source

pub fn max_query_terms(&self) -> usize

Returns the most terms in one keyword query. Checked before the query reaches FTS5. Default 32.

Source

pub fn max_query_chars(&self) -> usize

Returns the longest keyword query in chars. Checked before the query reaches FTS5. Default 2 000.

Trait Implementations§

Source§

impl Clone for VectorSettings

Source§

fn clone(&self) -> Self

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 VectorSettings

Source§

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

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

impl PartialEq for VectorSettings

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VectorSettings

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.