Return a MissingDocumentId when a document doesn't have one

This commit is contained in:
Kerollmops 2021-06-22 11:22:33 +02:00
parent b073fd49ea
commit 0cca2ea24f
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -18,7 +18,7 @@ use crate::index::db_name;
use crate::update::index_documents::merge_function::{keep_latest_obkv, merge_obkvs};
use crate::update::{AvailableDocumentsIds, UpdateIndexingStep};
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";
@ -190,7 +190,7 @@ impl Transform<'_, '_> {
},
None => {
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);
Cow::Borrowed(uuid)