mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Merge #3864
3864: Remove `/experimental-features` verbs that weren't in the PRD r=dureuill a=dureuill Removes: - POST `/experimental-features` - DELETE `/experimental-features` keeping only: - PATCH `/experimental-features` - GET `/experimental-features` The two routes that are described in the PRD. Following `@guimachiavelli's` [question](https://github.com/meilisearch/documentation/issues/2482#issuecomment-1611845372) about the POST route. Co-authored-by: Louis Dureuil <louis@meilisearch.com>
This commit is contained in:
commit
34a07110de
@ -18,9 +18,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
|||||||
cfg.service(
|
cfg.service(
|
||||||
web::resource("")
|
web::resource("")
|
||||||
.route(web::get().to(SeqHandler(get_features)))
|
.route(web::get().to(SeqHandler(get_features)))
|
||||||
.route(web::patch().to(SeqHandler(patch_features)))
|
.route(web::patch().to(SeqHandler(patch_features))),
|
||||||
.route(web::delete().to(SeqHandler(delete_features)))
|
|
||||||
.route(web::post().to(SeqHandler(post_features))),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,40 +68,3 @@ async fn patch_features(
|
|||||||
index_scheduler.put_runtime_features(new_features)?;
|
index_scheduler.put_runtime_features(new_features)?;
|
||||||
Ok(HttpResponse::Ok().json(new_features))
|
Ok(HttpResponse::Ok().json(new_features))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn post_features(
|
|
||||||
index_scheduler: GuardedData<
|
|
||||||
ActionPolicy<{ actions::EXPERIMENTAL_FEATURES_UPDATE }>,
|
|
||||||
Data<IndexScheduler>,
|
|
||||||
>,
|
|
||||||
new_features: AwebJson<RuntimeTogglableFeatures, DeserrJsonError>,
|
|
||||||
analytics: Data<dyn Analytics>,
|
|
||||||
req: HttpRequest,
|
|
||||||
) -> Result<HttpResponse, ResponseError> {
|
|
||||||
let new_features = meilisearch_types::features::RuntimeTogglableFeatures {
|
|
||||||
score_details: new_features.0.score_details.unwrap_or(false),
|
|
||||||
vector_store: new_features.0.vector_store.unwrap_or(false),
|
|
||||||
};
|
|
||||||
|
|
||||||
analytics.publish("Experimental features Updated".to_string(), json!(new_features), Some(&req));
|
|
||||||
index_scheduler.put_runtime_features(new_features)?;
|
|
||||||
Ok(HttpResponse::Ok().json(new_features))
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn delete_features(
|
|
||||||
index_scheduler: GuardedData<
|
|
||||||
ActionPolicy<{ actions::EXPERIMENTAL_FEATURES_UPDATE }>,
|
|
||||||
Data<IndexScheduler>,
|
|
||||||
>,
|
|
||||||
analytics: Data<dyn Analytics>,
|
|
||||||
req: HttpRequest,
|
|
||||||
) -> Result<HttpResponse, ResponseError> {
|
|
||||||
let deleted_features = Default::default();
|
|
||||||
analytics.publish(
|
|
||||||
"Experimental features Updated".to_string(),
|
|
||||||
json!(deleted_features),
|
|
||||||
Some(&req),
|
|
||||||
);
|
|
||||||
index_scheduler.put_runtime_features(deleted_features)?;
|
|
||||||
Ok(HttpResponse::Ok().json(deleted_features))
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user