mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
Merge #1222
1222: Ignore existing primary key r=Kerollmops a=MarinPostma fixing bug in #1176 made it an hard error to try to re-set the primary key on a document addition. This PR makes Meilisearch ignore a primary key passed as an argument to a document addition. This has been decided after a discussion with @curquiza, in order to make the bug fix non breaking. Turns out it was a good catch too, since contrary to what I thought the error was not caught asynchronously, thank you @curquiza Co-authored-by: mpostma <postma.marin@protonmail.com>
This commit is contained in:
commit
cb50781d2d
@ -175,7 +175,6 @@ async fn update_multiple_documents(
|
|||||||
.ok_or(meilisearch_core::Error::SchemaMissing)?;
|
.ok_or(meilisearch_core::Error::SchemaMissing)?;
|
||||||
|
|
||||||
match (params.into_inner().primary_key, schema.primary_key()) {
|
match (params.into_inner().primary_key, schema.primary_key()) {
|
||||||
(Some(_), Some(_)) => return Err(meilisearch_schema::Error::PrimaryKeyAlreadyPresent)?,
|
|
||||||
(Some(key), None) => document_addition.set_primary_key(key),
|
(Some(key), None) => document_addition.set_primary_key(key),
|
||||||
(None, None) => {
|
(None, None) => {
|
||||||
let key = body
|
let key = body
|
||||||
@ -184,7 +183,7 @@ async fn update_multiple_documents(
|
|||||||
.ok_or(meilisearch_core::Error::MissingPrimaryKey)?;
|
.ok_or(meilisearch_core::Error::MissingPrimaryKey)?;
|
||||||
document_addition.set_primary_key(key);
|
document_addition.set_primary_key(key);
|
||||||
}
|
}
|
||||||
(None, Some(_)) => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
for document in body.into_inner() {
|
for document in body.into_inner() {
|
||||||
|
Loading…
Reference in New Issue
Block a user