mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
Return a MissingDocumentId when a document doesn't have one
This commit is contained in:
parent
b073fd49ea
commit
0cca2ea24f
@ -18,7 +18,7 @@ use crate::index::db_name;
|
|||||||
use crate::update::index_documents::merge_function::{keep_latest_obkv, merge_obkvs};
|
use crate::update::index_documents::merge_function::{keep_latest_obkv, merge_obkvs};
|
||||||
use crate::update::{AvailableDocumentsIds, UpdateIndexingStep};
|
use crate::update::{AvailableDocumentsIds, UpdateIndexingStep};
|
||||||
use crate::{
|
use crate::{
|
||||||
ExternalDocumentsIds, FieldId, FieldDistribution, FieldsIdsMap, Index, MergeFn, Result, BEU32,
|
ExternalDocumentsIds, FieldDistribution, FieldId, FieldsIdsMap, Index, MergeFn, Result, BEU32,
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_PRIMARY_KEY_NAME: &str = "id";
|
const DEFAULT_PRIMARY_KEY_NAME: &str = "id";
|
||||||
@ -190,7 +190,7 @@ impl Transform<'_, '_> {
|
|||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
if !self.autogenerate_docids {
|
if !self.autogenerate_docids {
|
||||||
return Err(UserError::MissingPrimaryKey.into());
|
return Err(UserError::MissingDocumentId { document }.into());
|
||||||
}
|
}
|
||||||
let uuid = uuid::Uuid::new_v4().to_hyphenated().encode_lower(&mut uuid_buffer);
|
let uuid = uuid::Uuid::new_v4().to_hyphenated().encode_lower(&mut uuid_buffer);
|
||||||
Cow::Borrowed(uuid)
|
Cow::Borrowed(uuid)
|
||||||
|
Loading…
Reference in New Issue
Block a user