From fb539f61fe16831a008d3b948bc763ea89fc4eb6 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 7 Dec 2023 17:35:45 +0100 Subject: [PATCH] WIP --- .../src/update/index_documents/extract/mod.rs | 28 +++++++++++++------ .../src/update/index_documents/typed_chunk.rs | 7 ----- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/milli/src/update/index_documents/extract/mod.rs b/milli/src/update/index_documents/extract/mod.rs index 06bc8b609..69530a507 100644 --- a/milli/src/update/index_documents/extract/mod.rs +++ b/milli/src/update/index_documents/extract/mod.rs @@ -295,7 +295,7 @@ fn send_original_documents_data( let (embedder, prompt) = embedders.get("default").cloned().unzip(); let result = extract_vector_points(documents_chunk_cloned, indexer, field_id_map, prompt.as_deref()); - let _ = match result { + match result { Ok(ExtractedVectorPoints { manual_vectors, remove_vectors, prompts }) => { /// FIXME: support multiple embedders let results = embedder.and_then(|embedder| { @@ -309,15 +309,25 @@ fn send_original_documents_data( }); let (embeddings, expected_dimension) = results.unzip(); let expected_dimension = expected_dimension.flatten(); - lmdb_writer_sx_cloned.send(Ok(TypedChunk::VectorPoints { - remove_vectors, - embeddings, - /// FIXME: compute an expected dimension from the manual vectors if any - expected_dimension: expected_dimension.unwrap(), - manual_vectors, - })) + if !(remove_vectors.is_empty() + && manual_vectors.is_empty() + && embeddings.as_ref().map_or(true, |e| e.is_empty())) + { + /// FIXME FIXME FIXME + if expected_dimension.is_some() { + let _ = lmdb_writer_sx_cloned.send(Ok(TypedChunk::VectorPoints { + remove_vectors, + embeddings, + /// FIXME: compute an expected dimension from the manual vectors if any + expected_dimension: expected_dimension.unwrap(), + manual_vectors, + })); + } + } + } + Err(error) => { + let _ = lmdb_writer_sx_cloned.send(Err(error)); } - Err(error) => lmdb_writer_sx_cloned.send(Err(error)), }; }); diff --git a/milli/src/update/index_documents/typed_chunk.rs b/milli/src/update/index_documents/typed_chunk.rs index 82397ed3d..84b17dca9 100644 --- a/milli/src/update/index_documents/typed_chunk.rs +++ b/milli/src/update/index_documents/typed_chunk.rs @@ -361,13 +361,6 @@ pub(crate) fn write_typed_chunk_into_index( embeddings, expected_dimension, } => { - if remove_vectors.is_empty() - && manual_vectors.is_empty() - && embeddings.as_ref().map_or(true, |e| e.is_empty()) - { - return Ok((RoaringBitmap::new(), is_merged_database)); - } - /// FIXME: allow customizing distance let writers: std::result::Result, _> = (0..=u8::MAX) .map(|k| {