use arrow_array::ArrayRef;
use lance_linalg::distance::MetricType;
pub mod bq;
pub mod flat;
pub mod graph;
pub mod hnsw;
pub mod ivf;
pub mod kmeans;
pub mod pq;
pub mod quantizer;
pub mod residual;
pub mod sq;
pub mod transform;
pub mod utils;
pub const PQ_CODE_COLUMN: &str = "__pq_code";
pub const SQ_CODE_COLUMN: &str = "__sq_code";
pub const PART_ID_COLUMN: &str = "__ivf_part_id";
pub const DIST_COL: &str = "_distance";
use super::pb;
pub use residual::RESIDUAL_COLUMN;
#[derive(Debug, Clone)]
pub struct Query {
pub column: String,
pub key: ArrayRef,
pub k: usize,
pub nprobes: usize,
pub ef: Option<usize>,
pub refine_factor: Option<u32>,
pub metric_type: MetricType,
pub use_index: bool,
}
impl From<pb::VectorMetricType> for MetricType {
fn from(proto: pb::VectorMetricType) -> Self {
match proto {
pb::VectorMetricType::L2 => Self::L2,
pb::VectorMetricType::Cosine => Self::Cosine,
pb::VectorMetricType::Dot => Self::Dot,
}
}
}
impl From<MetricType> for pb::VectorMetricType {
fn from(mt: MetricType) -> Self {
match mt {
MetricType::L2 => Self::L2,
MetricType::Cosine => Self::Cosine,
MetricType::Dot => Self::Dot,
}
}
}