mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-04 12:38:38 +00:00
feat: allow explicit index builder uuid
This commit is contained in:
@@ -189,6 +189,7 @@ pub struct IndexBuilder {
|
||||
pub(crate) index: Index,
|
||||
pub(crate) columns: Vec<String>,
|
||||
pub(crate) replace: bool,
|
||||
pub(crate) index_uuid: Option<uuid::Uuid>,
|
||||
pub(crate) wait_timeout: Option<Duration>,
|
||||
pub(crate) train: bool,
|
||||
pub(crate) name: Option<String>,
|
||||
@@ -201,6 +202,7 @@ impl IndexBuilder {
|
||||
index,
|
||||
columns,
|
||||
replace: true,
|
||||
index_uuid: None,
|
||||
train: true,
|
||||
wait_timeout: None,
|
||||
name: None,
|
||||
@@ -217,6 +219,12 @@ impl IndexBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Use a caller-selected UUID for the created index.
|
||||
pub fn index_uuid(mut self, uuid: uuid::Uuid) -> Self {
|
||||
self.index_uuid = Some(uuid);
|
||||
self
|
||||
}
|
||||
|
||||
/// The name of the index. If not set, a default name will be generated.
|
||||
///
|
||||
/// # Examples
|
||||
|
||||
@@ -156,6 +156,9 @@ impl NativeTable {
|
||||
.train(opts.train)
|
||||
.replace(opts.replace);
|
||||
|
||||
if let Some(index_uuid) = opts.index_uuid {
|
||||
builder = builder.index_uuid(index_uuid);
|
||||
}
|
||||
if let Some(name) = opts.name {
|
||||
builder = builder.name(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user