use lance_core::Result;
use lance_table::format::IndexMetadata;
#[derive(Debug, Default)]
pub struct IndexCriteria<'a> {
pub for_column: Option<&'a str>,
pub has_name: Option<&'a str>,
pub must_support_fts: bool,
pub must_support_exact_equality: bool,
}
impl<'a> IndexCriteria<'a> {
pub fn for_column(mut self, column: &'a str) -> Self {
self.for_column = Some(column);
self
}
pub fn with_name(mut self, name: &'a str) -> Self {
self.has_name = Some(name);
self
}
pub fn supports_fts(mut self) -> Self {
self.must_support_fts = true;
self
}
pub fn supports_exact_equality(mut self) -> Self {
self.must_support_exact_equality = true;
self
}
}
#[deprecated(since = "0.39.0", note = "Use IndexCriteria instead")]
pub type ScalarIndexCriteria<'a> = IndexCriteria<'a>;
#[non_exhaustive]
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct FtsPrewarmOptions {
pub with_position: bool,
}
impl FtsPrewarmOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_position(mut self, with_position: bool) -> Self {
self.with_position = with_position;
self
}
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PrewarmOptions {
Fts(FtsPrewarmOptions),
}
pub trait IndexDescription: Send + Sync {
fn name(&self) -> &str;
fn metadata(&self) -> &[IndexMetadata];
fn segments(&self) -> &[IndexMetadata] {
self.metadata()
}
fn type_url(&self) -> &str;
fn index_type(&self) -> &str;
fn rows_indexed(&self) -> u64;
fn field_ids(&self) -> &[u32];
fn details(&self) -> Result<String>;
fn total_size_bytes(&self) -> Option<u64>;
}