diff --git a/milli/src/documents/builder.rs b/milli/src/documents/builder.rs index dc027e1b7..1a57db34b 100644 --- a/milli/src/documents/builder.rs +++ b/milli/src/documents/builder.rs @@ -97,6 +97,7 @@ impl DocumentsBatchBuilder { .map(|(k, t)| (self.fields_index.insert(k), t)) .enumerate() .collect(); + // Make sure that we insert the fields ids in order as the obkv writer has this requirement. typed_fields_ids.sort_unstable_by_key(|(_, (fid, _))| *fid); let mut record = csv::StringRecord::new();