mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
fix comments from review
This commit is contained in:
parent
b06e33f3d3
commit
ef3bcd65ab
5 changed files with 20 additions and 24 deletions
|
@ -180,9 +180,8 @@ pub async fn create_index(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
if let Some(id) = body.primary_key.clone() {
|
||||
if let Some(mut schema) = created_index.main.schema(&mut writer)? {
|
||||
if let Ok(_) = schema.set_primary_key(&id) {
|
||||
created_index.main.put_schema(&mut writer, &schema)?;
|
||||
}
|
||||
schema.set_primary_key(&id).map_err(ResponseError::bad_request)?;
|
||||
created_index.main.put_schema(&mut writer, &schema)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,13 +238,14 @@ pub async fn update_index(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
match schema.primary_key() {
|
||||
Some(_) => {
|
||||
return Err(ResponseError::bad_request(
|
||||
"The index primary key cannot be updated",
|
||||
"The primary key cannot be updated",
|
||||
));
|
||||
}
|
||||
None => {
|
||||
if let Ok(_) = schema.set_primary_key(&id) {
|
||||
index.main.put_schema(&mut writer, &schema)?;
|
||||
}
|
||||
schema
|
||||
.set_primary_key(&id)
|
||||
.map_err(ResponseError::bad_request)?;
|
||||
index.main.put_schema(&mut writer, &schema)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue