mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Check experimental feature at query time
This commit is contained in:
parent
a0e713c4e7
commit
ee54d3171e
@ -1351,9 +1351,6 @@ impl IndexScheduler {
|
|||||||
|
|
||||||
for (task, (_, settings)) in tasks.iter_mut().zip(settings) {
|
for (task, (_, settings)) in tasks.iter_mut().zip(settings) {
|
||||||
let checked_settings = settings.clone().check();
|
let checked_settings = settings.clone().check();
|
||||||
if matches!(checked_settings.embedders, milli::update::Setting::Set(_)) {
|
|
||||||
self.features().check_vector("Passing `embedders` in settings")?
|
|
||||||
}
|
|
||||||
task.details = Some(Details::SettingsUpdate { settings: Box::new(settings) });
|
task.details = Some(Details::SettingsUpdate { settings: Box::new(settings) });
|
||||||
apply_settings_to_builder(&checked_settings, &mut builder);
|
apply_settings_to_builder(&checked_settings, &mut builder);
|
||||||
|
|
||||||
|
@ -90,7 +90,10 @@ macro_rules! make_setting_route {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let new_settings = new_settings.validate()?;
|
let new_settings = $crate::routes::indexes::settings::validate_settings(
|
||||||
|
new_settings,
|
||||||
|
&index_scheduler,
|
||||||
|
)?;
|
||||||
|
|
||||||
let allow_index_creation =
|
let allow_index_creation =
|
||||||
index_scheduler.filters().allow_index_creation(&index_uid);
|
index_scheduler.filters().allow_index_creation(&index_uid);
|
||||||
@ -653,7 +656,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()?;
|
let new_settings = validate_settings(new_settings, &index_scheduler)?;
|
||||||
|
|
||||||
analytics.publish(
|
analytics.publish(
|
||||||
"Settings Updated".to_string(),
|
"Settings Updated".to_string(),
|
||||||
@ -803,3 +806,13 @@ pub async fn delete_all(
|
|||||||
debug!("returns: {:?}", task);
|
debug!("returns: {:?}", task);
|
||||||
Ok(HttpResponse::Accepted().json(task))
|
Ok(HttpResponse::Accepted().json(task))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn validate_settings(
|
||||||
|
settings: Settings<Unchecked>,
|
||||||
|
index_scheduler: &IndexScheduler,
|
||||||
|
) -> Result<Settings<Unchecked>, ResponseError> {
|
||||||
|
if matches!(settings.embedders, Setting::Set(_)) {
|
||||||
|
index_scheduler.features().check_vector("Passing `embedders` in settings")?
|
||||||
|
}
|
||||||
|
Ok(settings.validate()?)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user