mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-10 21:44:34 +01:00
Validate settings in route
This commit is contained in:
parent
ec9649c922
commit
2e4c9651df
@ -90,6 +90,8 @@ macro_rules! make_setting_route {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let new_settings = new_settings.validate()?;
|
||||||
|
|
||||||
let allow_index_creation =
|
let allow_index_creation =
|
||||||
index_scheduler.filters().allow_index_creation(&index_uid);
|
index_scheduler.filters().allow_index_creation(&index_uid);
|
||||||
|
|
||||||
@ -582,13 +584,13 @@ fn embedder_analytics(
|
|||||||
for source in s
|
for source in s
|
||||||
.values()
|
.values()
|
||||||
.filter_map(|config| config.clone().set())
|
.filter_map(|config| config.clone().set())
|
||||||
.filter_map(|config| config.embedder_options.set())
|
.filter_map(|config| config.source.set())
|
||||||
{
|
{
|
||||||
use meilisearch_types::milli::vector::settings::EmbedderSettings;
|
use meilisearch_types::milli::vector::settings::EmbedderSource;
|
||||||
match source {
|
match source {
|
||||||
EmbedderSettings::OpenAi(_) => sources.insert("openAi"),
|
EmbedderSource::OpenAi => sources.insert("openAi"),
|
||||||
EmbedderSettings::HuggingFace(_) => sources.insert("huggingFace"),
|
EmbedderSource::HuggingFace => sources.insert("huggingFace"),
|
||||||
EmbedderSettings::UserProvided(_) => sources.insert("userProvided"),
|
EmbedderSource::UserProvided => sources.insert("userProvided"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -651,6 +653,7 @@ pub async fn update_all(
|
|||||||
let index_uid = IndexUid::try_from(index_uid.into_inner())?;
|
let index_uid = IndexUid::try_from(index_uid.into_inner())?;
|
||||||
|
|
||||||
let new_settings = body.into_inner();
|
let new_settings = body.into_inner();
|
||||||
|
let new_settings = new_settings.validate()?;
|
||||||
|
|
||||||
analytics.publish(
|
analytics.publish(
|
||||||
"Settings Updated".to_string(),
|
"Settings Updated".to_string(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user