From 8a941c0241cb62956662f9725782b5a1db132339 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 22 May 2024 12:26:00 +0200 Subject: [PATCH] Smaller review changes --- index-scheduler/src/batch.rs | 17 ++++++++++------- milli/src/index.rs | 4 ++-- .../extract/extract_vector_points.rs | 4 +--- milli/src/update/index_documents/extract/mod.rs | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index 1f5ec76b9..d10f83a0a 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -31,7 +31,9 @@ use meilisearch_types::milli::heed::CompactionOption; use meilisearch_types::milli::update::{ IndexDocumentsConfig, IndexDocumentsMethod, IndexerConfig, Settings as MilliSettings, }; -use meilisearch_types::milli::vector::parsed_vectors::RESERVED_VECTORS_FIELD_NAME; +use meilisearch_types::milli::vector::parsed_vectors::{ + ExplicitVectors, VectorOrArrayOfVectors, RESERVED_VECTORS_FIELD_NAME, +}; use meilisearch_types::milli::{self, Filter}; use meilisearch_types::settings::{apply_settings_to_builder, Settings, Unchecked}; use meilisearch_types::tasks::{Details, IndexSwap, Kind, KindWithContent, Status, Task}; @@ -955,12 +957,13 @@ impl IndexScheduler { for (embedder_name, embeddings) in embeddings { // don't change the entry if it already exists, because it was user-provided vectors.entry(embedder_name).or_insert_with(|| { - - let embeddings = milli::vector::parsed_vectors::ExplicitVectors { - embeddings: milli::vector::parsed_vectors::VectorOrArrayOfVectors::from_array_of_vectors(embeddings), - user_provided: false, - }; - serde_json::to_value(embeddings).unwrap() + let embeddings = ExplicitVectors { + embeddings: VectorOrArrayOfVectors::from_array_of_vectors( + embeddings, + ), + user_provided: false, + }; + serde_json::to_value(embeddings).unwrap() }); } } diff --git a/milli/src/index.rs b/milli/src/index.rs index 66cd6f3cc..982be0139 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -23,7 +23,7 @@ use crate::heed_codec::{ }; use crate::order_by_map::OrderByMap; use crate::proximity::ProximityPrecision; -use crate::vector::EmbeddingConfig; +use crate::vector::{Embedding, EmbeddingConfig}; use crate::{ default_criteria, CboRoaringBitmapCodec, Criterion, DocumentId, ExternalDocumentsIds, FacetDistribution, FieldDistribution, FieldId, FieldIdMapMissingEntry, FieldIdWordCountCodec, @@ -1611,7 +1611,7 @@ impl Index { &self, rtxn: &RoTxn<'_>, docid: DocumentId, - ) -> Result>> { + ) -> Result>> { let mut res = BTreeMap::new(); for row in self.embedder_category_id.iter(rtxn)? { let (embedder_name, embedder_id) = row?; diff --git a/milli/src/update/index_documents/extract/extract_vector_points.rs b/milli/src/update/index_documents/extract/extract_vector_points.rs index 8b78a8c55..724d9ea81 100644 --- a/milli/src/update/index_documents/extract/extract_vector_points.rs +++ b/milli/src/update/index_documents/extract/extract_vector_points.rs @@ -89,7 +89,7 @@ struct EmbedderVectorExtractor { pub fn extract_vector_points( obkv_documents: grenad::Reader, indexer: GrenadParameters, - settings_diff: Arc, + settings_diff: &InnerIndexSettingsDiff, ) -> Result> { puffin::profile_function!(); @@ -258,8 +258,6 @@ pub fn extract_vector_points( } } - ///// - let mut results = Vec::new(); for EmbedderVectorExtractor { diff --git a/milli/src/update/index_documents/extract/mod.rs b/milli/src/update/index_documents/extract/mod.rs index 0ea0fcc5c..7598c8094 100644 --- a/milli/src/update/index_documents/extract/mod.rs +++ b/milli/src/update/index_documents/extract/mod.rs @@ -241,7 +241,7 @@ fn send_original_documents_data( let original_documents_chunk = original_documents_chunk.clone(); let lmdb_writer_sx = lmdb_writer_sx.clone(); rayon::spawn(move || { - match extract_vector_points(original_documents_chunk.clone(), indexer, settings_diff) { + match extract_vector_points(original_documents_chunk.clone(), indexer, &settings_diff) { Ok(extracted_vectors) => { for ExtractedVectorPoints { manual_vectors,