mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-18 17:11:15 +08:00
Do not change the primary key type when we serialize documents
This commit is contained in:
parent
69acdd437e
commit
89ce4e74fe
@ -178,16 +178,10 @@ impl Transform<'_, '_> {
|
|||||||
serde_json::to_writer(&mut json_buffer, value)?;
|
serde_json::to_writer(&mut json_buffer, value)?;
|
||||||
writer.insert(field_id, &json_buffer)?;
|
writer.insert(field_id, &json_buffer)?;
|
||||||
}
|
}
|
||||||
else if field_id == primary_key_id {
|
|
||||||
// We validate the document id [a-zA-Z0-9\-_].
|
|
||||||
let external_id = match validate_document_id(&external_id) {
|
|
||||||
Some(valid) => valid,
|
|
||||||
None => return Err(anyhow!("invalid document id: {:?}", external_id)),
|
|
||||||
};
|
|
||||||
|
|
||||||
// We serialize the document id.
|
// We validate the document id [a-zA-Z0-9\-_].
|
||||||
serde_json::to_writer(&mut json_buffer, &external_id)?;
|
if field_id == primary_key_id && validate_document_id(&external_id).is_none() {
|
||||||
writer.insert(field_id, &json_buffer)?;
|
return Err(anyhow!("invalid document id: {:?}", external_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user