mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 00:31:02 +00:00
implement update index
implement update index
This commit is contained in:
@ -6,7 +6,7 @@ use futures_util::stream::StreamExt;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
use super::Data;
|
||||
use crate::index_controller::{IndexController, Settings};
|
||||
use crate::index_controller::{IndexController, Settings, IndexSettings, IndexMetadata};
|
||||
use crate::index_controller::UpdateStatus;
|
||||
|
||||
impl Data {
|
||||
@ -70,4 +70,18 @@ impl Data {
|
||||
pub fn get_updates_status(&self, index: impl AsRef<str>) -> anyhow::Result<Vec<UpdateStatus>> {
|
||||
self.index_controller.all_update_status(index)
|
||||
}
|
||||
|
||||
pub fn update_index(
|
||||
&self,
|
||||
name: impl AsRef<str>,
|
||||
primary_key: Option<impl AsRef<str>>,
|
||||
new_name: Option<impl AsRef<str>>
|
||||
) -> anyhow::Result<IndexMetadata> {
|
||||
let settings = IndexSettings {
|
||||
name: new_name.map(|s| s.as_ref().to_string()),
|
||||
primary_key: primary_key.map(|s| s.as_ref().to_string()),
|
||||
};
|
||||
|
||||
self.index_controller.update_index(name, settings)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user