pub struct IndexParams { /* private fields */ }Expand description
Parameters for configuring an index on a field.
Implementations§
Source§impl IndexParams
impl IndexParams
Sourcepub unsafe fn as_raw(&self) -> *mut zvec_index_params_t
pub unsafe fn as_raw(&self) -> *mut zvec_index_params_t
Returns the raw FFI handle.
§Safety
The caller must not use the handle after the IndexParams is dropped.
Sourcepub fn hnsw(metric: MetricType, m: i32, ef_construction: i32) -> Result<Self>
pub fn hnsw(metric: MetricType, m: i32, ef_construction: i32) -> Result<Self>
Creates HNSW index parameters.
Sourcepub fn hnsw_with_quantize(
metric: MetricType,
m: i32,
ef_construction: i32,
quantize: QuantizeType,
) -> Result<Self>
pub fn hnsw_with_quantize( metric: MetricType, m: i32, ef_construction: i32, quantize: QuantizeType, ) -> Result<Self>
Creates HNSW index parameters with quantization.
Sourcepub fn ivf(
metric: MetricType,
n_list: i32,
n_iters: i32,
use_soar: bool,
) -> Result<Self>
pub fn ivf( metric: MetricType, n_list: i32, n_iters: i32, use_soar: bool, ) -> Result<Self>
Creates IVF index parameters.
Sourcepub fn ivf_rabitq(
metric: MetricType,
nlist: i32,
total_bits: i32,
sample_count: i32,
) -> Result<Self>
pub fn ivf_rabitq( metric: MetricType, nlist: i32, total_bits: i32, sample_count: i32, ) -> Result<Self>
Creates IVF RaBitQ index parameters.
IVF RaBitQ combines inverted-file clustering with RaBitQ quantization for memory-efficient approximate search.
nlist: number of cluster centerstotal_bits: total bits for RaBitQ quantizationsample_count: sample count for training;0uses all vectors
Sourcepub fn flat(metric: MetricType) -> Result<Self>
pub fn flat(metric: MetricType) -> Result<Self>
Creates Flat index parameters.
Sourcepub fn diskann(
metric: MetricType,
max_degree: i32,
list_size: i32,
pq_chunk_num: i32,
) -> Result<Self>
pub fn diskann( metric: MetricType, max_degree: i32, list_size: i32, pq_chunk_num: i32, ) -> Result<Self>
Creates DiskANN index parameters.
DiskANN is a disk-based graph index that keeps the bulk of the index on disk, drastically reducing memory usage for large datasets.
max_degree: graph connectivity, i.e. max out-degree of the graph (typical: 64)list_size: build-time candidate list size during construction (typical: 100)pq_chunk_num: PQ chunk count;0disables product quantization
Sourcepub fn invert(enable_range_opt: bool, enable_wildcard: bool) -> Result<Self>
pub fn invert(enable_range_opt: bool, enable_wildcard: bool) -> Result<Self>
Creates inverted index parameters for scalar fields.
Sourcepub fn fts(
tokenizer_name: Option<&str>,
filters: Option<&[&str]>,
extra_params: Option<&str>,
) -> Result<Self>
pub fn fts( tokenizer_name: Option<&str>, filters: Option<&[&str]>, extra_params: Option<&str>, ) -> Result<Self>
Creates FTS (Full-Text Search) index parameters.
All parameters are optional — passing None keeps the library default.
Sourcepub fn index_type(&self) -> IndexType
pub fn index_type(&self) -> IndexType
Returns the index type.
Sourcepub fn metric_type(&self) -> MetricType
pub fn metric_type(&self) -> MetricType
Returns the metric type.
Sourcepub fn quantize_type(&self) -> QuantizeType
pub fn quantize_type(&self) -> QuantizeType
Returns the quantize type.
Sourcepub fn quantizer_enable_rotate(&self) -> bool
pub fn quantizer_enable_rotate(&self) -> bool
Returns whether vectors are randomly rotated before quantization.
Sourcepub fn set_metric_type(&mut self, metric: MetricType) -> Result<()>
pub fn set_metric_type(&mut self, metric: MetricType) -> Result<()>
Sets the metric type.
Sourcepub fn set_quantize_type(&mut self, quantize: QuantizeType) -> Result<()>
pub fn set_quantize_type(&mut self, quantize: QuantizeType) -> Result<()>
Sets the quantize type.
Sourcepub fn set_quantizer_enable_rotate(&mut self, enable_rotate: bool) -> Result<()>
pub fn set_quantizer_enable_rotate(&mut self, enable_rotate: bool) -> Result<()>
Enables or disables random rotation before quantization.
Rotating vectors before Int8 / Int4 quantization reduces the
quantization error. The rotation matrix is stored with the index and
applied to query vectors at search time, so it has no effect with other
quantize types.
Only vector index params accept this option; scalar indexes (invert,
fts) return ErrorCode::InvalidArgument.