Skip to main content

IndexParams

Struct IndexParams 

Source
pub struct IndexParams { /* private fields */ }
Expand description

Parameters for configuring an index on a field.

Implementations§

Source§

impl IndexParams

Source

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.

Source

pub fn hnsw(metric: MetricType, m: i32, ef_construction: i32) -> Result<Self>

Creates HNSW index parameters.

Source

pub fn hnsw_with_quantize( metric: MetricType, m: i32, ef_construction: i32, quantize: QuantizeType, ) -> Result<Self>

Creates HNSW index parameters with quantization.

Source

pub fn ivf( metric: MetricType, n_list: i32, n_iters: i32, use_soar: bool, ) -> Result<Self>

Creates IVF index parameters.

Source

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 centers
  • total_bits: total bits for RaBitQ quantization
  • sample_count: sample count for training; 0 uses all vectors
Source

pub fn flat(metric: MetricType) -> Result<Self>

Creates Flat index parameters.

Source

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; 0 disables product quantization
Source

pub fn invert(enable_range_opt: bool, enable_wildcard: bool) -> Result<Self>

Creates inverted index parameters for scalar fields.

Source

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.

Source

pub fn index_type(&self) -> IndexType

Returns the index type.

Source

pub fn metric_type(&self) -> MetricType

Returns the metric type.

Source

pub fn quantize_type(&self) -> QuantizeType

Returns the quantize type.

Source

pub fn quantizer_enable_rotate(&self) -> bool

Returns whether vectors are randomly rotated before quantization.

Source

pub fn set_metric_type(&mut self, metric: MetricType) -> Result<()>

Sets the metric type.

Source

pub fn set_quantize_type(&mut self, quantize: QuantizeType) -> Result<()>

Sets the quantize type.

Source

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.

Trait Implementations§

Source§

impl Drop for IndexParams

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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, 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.