From 477077bdc20f4629783d7420d1537800025e9e1f Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 20 Nov 2024 10:51:11 +0100 Subject: [PATCH] Remove `_vectors` from fid map when there are no vectors in sight --- crates/milli/src/update/new/document.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/milli/src/update/new/document.rs b/crates/milli/src/update/new/document.rs index ae9aa9de9..04bce07e9 100644 --- a/crates/milli/src/update/new/document.rs +++ b/crates/milli/src/update/new/document.rs @@ -322,10 +322,6 @@ where 'inject_vectors: { let Some(vector_document) = vector_document else { break 'inject_vectors }; - let vectors_fid = fields_ids_map - .id_or_insert(RESERVED_VECTORS_FIELD_NAME) - .ok_or(UserError::AttributeLimitReached)?; - let mut vectors = BTreeMap::new(); for res in vector_document.iter_vectors() { let (name, entry) = res?; @@ -350,6 +346,10 @@ where break 'inject_vectors; } + let vectors_fid = fields_ids_map + .id_or_insert(RESERVED_VECTORS_FIELD_NAME) + .ok_or(UserError::AttributeLimitReached)?; + vectors_value = serde_json::value::to_raw_value(&vectors).unwrap(); unordered_field_buffer.push((vectors_fid, &vectors_value)); }