#[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
impl VectorSettings
Sourcepub fn new(dims: usize) -> Self
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.
Sourcepub fn with_kind(self, kind: IndexKind) -> Self
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.
Sourcepub fn with_quantization(self, quantization: Quantization) -> Self
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.
Sourcepub fn with_max_text_bytes(self, bytes: usize) -> Self
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.
Sourcepub fn with_max_meta_pairs(self, pairs: usize) -> Self
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.
Sourcepub fn with_max_meta_key_bytes(self, bytes: usize) -> Self
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.
Sourcepub fn with_max_meta_value_bytes(self, bytes: usize) -> Self
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.
Sourcepub fn with_max_batch(self, records: usize) -> Self
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.
Sourcepub fn with_max_query_terms(self, terms: usize) -> Self
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.
Sourcepub fn with_max_query_chars(self, chars: usize) -> Self
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.
Sourcepub fn dims(&self) -> usize
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.
Sourcepub fn kind(&self) -> &IndexKind
pub fn kind(&self) -> &IndexKind
Returns the index kind.
Brute force is exact; HNSW is approximate and faster.
Default IndexKind::BruteForce.
Sourcepub fn quantization(&self) -> Quantization
pub fn quantization(&self) -> Quantization
Returns the in-memory vector format.
The file always keeps f32.
Default Quantization::F32.
Sourcepub fn max_text_bytes(&self) -> usize
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.
Sourcepub fn max_meta_pairs(&self) -> usize
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.
Sourcepub fn max_meta_key_bytes(&self) -> usize
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.
Sourcepub fn max_meta_value_bytes(&self) -> usize
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.
Sourcepub fn max_batch(&self) -> usize
pub fn max_batch(&self) -> usize
Returns the most records per write call. It bounds one transaction. Default 10 000.
Sourcepub fn max_query_terms(&self) -> usize
pub fn max_query_terms(&self) -> usize
Returns the most terms in one keyword query. Checked before the query reaches FTS5. Default 32.
Sourcepub fn max_query_chars(&self) -> usize
pub fn max_query_chars(&self) -> usize
Returns the longest keyword query in chars. Checked before the query reaches FTS5. Default 2 000.