pub struct AnnIndexDef {
pub index_name: String,
pub collection: String,
pub index_type: AnnIndexType,
pub metric: VectorMetric,
pub ivfflat_params: Option<IvfflatParams>,
pub hnsw_params: Option<HnswParams>,
pub concurrently: bool,
}Expand description
ANN 索引定义
Fields§
§index_name: String索引名称
collection: String集合名称
index_type: AnnIndexType索引类型
metric: VectorMetric距离度量
ivfflat_params: Option<IvfflatParams>IVFFlat 参数(仅当 index_type == Ivfflat 时有效)
hnsw_params: Option<HnswParams>HNSW 参数(仅当 index_type == Hnsw 时有效)
concurrently: bool是否并发创建(CONCURRENTLY,不锁表)
Implementations§
Source§impl AnnIndexDef
impl AnnIndexDef
Sourcepub fn new_ivfflat(
collection: &str,
metric: VectorMetric,
params: IvfflatParams,
) -> Self
pub fn new_ivfflat( collection: &str, metric: VectorMetric, params: IvfflatParams, ) -> Self
创建 IVFFlat 索引定义
Sourcepub fn new_hnsw(
collection: &str,
metric: VectorMetric,
params: HnswParams,
) -> Self
pub fn new_hnsw( collection: &str, metric: VectorMetric, params: HnswParams, ) -> Self
创建 HNSW 索引定义
Sourcepub fn with_concurrently(self) -> Self
pub fn with_concurrently(self) -> Self
设置并发创建(不锁表)
Sourcepub fn to_create_sql(&self) -> String
pub fn to_create_sql(&self) -> String
生成 CREATE INDEX SQL
Sourcepub fn to_drop_sql(&self) -> String
pub fn to_drop_sql(&self) -> String
生成 DROP INDEX SQL
Sourcepub fn to_reindex_sql(&self) -> String
pub fn to_reindex_sql(&self) -> String
生成 REINDEX SQL
Trait Implementations§
Source§impl Clone for AnnIndexDef
impl Clone for AnnIndexDef
Source§fn clone(&self) -> AnnIndexDef
fn clone(&self) -> AnnIndexDef
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AnnIndexDef
impl RefUnwindSafe for AnnIndexDef
impl Send for AnnIndexDef
impl Sync for AnnIndexDef
impl Unpin for AnnIndexDef
impl UnsafeUnpin for AnnIndexDef
impl UnwindSafe for AnnIndexDef
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