Remove _vectors from fid map when there are no vectors in sight

This commit is contained in:
Louis Dureuil 2024-11-20 10:51:11 +01:00 committed by Clément Renault
parent b1f8aec348
commit 477077bdc2
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -322,10 +322,6 @@ where
'inject_vectors: { 'inject_vectors: {
let Some(vector_document) = vector_document else { break '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(); let mut vectors = BTreeMap::new();
for res in vector_document.iter_vectors() { for res in vector_document.iter_vectors() {
let (name, entry) = res?; let (name, entry) = res?;
@ -350,6 +346,10 @@ where
break 'inject_vectors; 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(); vectors_value = serde_json::value::to_raw_value(&vectors).unwrap();
unordered_field_buffer.push((vectors_fid, &vectors_value)); unordered_field_buffer.push((vectors_fid, &vectors_value));
} }