mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Update index-scheduler/src/batch.rs
Co-authored-by: Clément Renault <clement@meilisearch.com>
This commit is contained in:
parent
7d1ebb7295
commit
a4be4c49e8
@ -1001,17 +1001,14 @@ impl IndexScheduler {
|
|||||||
|
|
||||||
if let Some(primary_key) = primary_key {
|
if let Some(primary_key) = primary_key {
|
||||||
match index.primary_key(index_wtxn)? {
|
match index.primary_key(index_wtxn)? {
|
||||||
// if a primary key was set AND had already be defined in the index
|
// if a primary key was set AND had already been defined in the index
|
||||||
// but to a different value then we can make the whole batch fail.
|
// but to a different value, we can make the whole batch fail.
|
||||||
Some(pk) if primary_key != pk => {
|
Some(pk) => if primary_key != pk {
|
||||||
return Err(milli::Error::from(
|
return Err(milli::Error::from(
|
||||||
milli::UserError::PrimaryKeyCannotBeChanged(pk.to_string()),
|
milli::UserError::PrimaryKeyCannotBeChanged(pk.to_string()),
|
||||||
)
|
)
|
||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
// if the primary key was set and equal to the one already set for
|
|
||||||
// the index then there is nothing to do.
|
|
||||||
Some(_) => (),
|
|
||||||
// if the primary key was set and there was no primary key set for this index
|
// if the primary key was set and there was no primary key set for this index
|
||||||
// we set it to the received value before starting the indexing process.
|
// we set it to the received value before starting the indexing process.
|
||||||
None => {
|
None => {
|
||||||
|
Loading…
Reference in New Issue
Block a user