From a489b406b4b3ff60d3bd97edef3702e91e2767a6 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Wed, 3 Apr 2024 19:10:19 +0200 Subject: [PATCH] fix test --- meilisearch/tests/settings/get_settings.rs | 4 +++- .../extract/extract_docid_word_positions.rs | 3 --- .../src/update/index_documents/extract/mod.rs | 24 +++++++++---------- milli/src/update/index_documents/mod.rs | 2 +- milli/src/update/settings.rs | 1 - 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/meilisearch/tests/settings/get_settings.rs b/meilisearch/tests/settings/get_settings.rs index 980ef3064..042dcca41 100644 --- a/meilisearch/tests/settings/get_settings.rs +++ b/meilisearch/tests/settings/get_settings.rs @@ -113,7 +113,8 @@ async fn secrets_are_hidden_in_settings() { "default": { "source": "rest", "url": "https://localhost:7777", - "apiKey": "My super secret value you will never guess" + "apiKey": "My super secret value you will never guess", + "dimensions": 4, } } })) @@ -184,6 +185,7 @@ async fn secrets_are_hidden_in_settings() { "default": { "source": "rest", "apiKey": "My suXXXXXX...", + "dimensions": 4, "documentTemplate": "{% for field in fields %} {{ field.name }}: {{ field.value }}\n{% endfor %}", "url": "https://localhost:7777", "query": null, diff --git a/milli/src/update/index_documents/extract/extract_docid_word_positions.rs b/milli/src/update/index_documents/extract/extract_docid_word_positions.rs index 6cf7b3167..6af5bba6d 100644 --- a/milli/src/update/index_documents/extract/extract_docid_word_positions.rs +++ b/milli/src/update/index_documents/extract/extract_docid_word_positions.rs @@ -55,7 +55,6 @@ pub fn extract_docid_word_positions( let mut value_buffer = Vec::new(); // initialize tokenizer. - /// TODO: Fix ugly allocation let old_stop_words = settings_diff.old.stop_words.as_ref(); let old_separators: Option> = settings_diff .old @@ -72,7 +71,6 @@ pub fn extract_docid_word_positions( ); let del_tokenizer = del_builder.build(); - /// TODO: Fix ugly allocation let new_stop_words = settings_diff.new.stop_words.as_ref(); let new_separators: Option> = settings_diff .new @@ -267,7 +265,6 @@ fn lang_safe_tokens_from_document<'a>( // then we don't rerun the extraction. if !script_language.is_empty() { // build a new temporary tokenizer including the allow list. - /// TODO: Fix ugly allocation let stop_words = settings.stop_words.as_ref(); let separators: Option> = settings .allowed_separators diff --git a/milli/src/update/index_documents/extract/mod.rs b/milli/src/update/index_documents/extract/mod.rs index 924561dea..341cdc9f9 100644 --- a/milli/src/update/index_documents/extract/mod.rs +++ b/milli/src/update/index_documents/extract/mod.rs @@ -198,7 +198,6 @@ fn run_extraction_task( M: Send, { let current_span = tracing::Span::current(); - /// TODO: remove clone let settings_diff = settings_diff.clone(); rayon::spawn(move || { @@ -236,7 +235,6 @@ fn send_original_documents_data( .build()?; if settings_diff.reindex_vectors() || !settings_diff.settings_update_only() { - /// TODO: remove clone let settings_diff = settings_diff.clone(); rayon::spawn(move || { for (name, (embedder, prompt)) in settings_diff.new.embedding_configs.clone() { @@ -250,17 +248,17 @@ fn send_original_documents_data( match result { Ok(ExtractedVectorPoints { manual_vectors, remove_vectors, prompts }) => { let embeddings = match extract_embeddings( - prompts, - indexer, - embedder.clone(), - &request_threads, - ) { - Ok(results) => Some(results), - Err(error) => { - let _ = lmdb_writer_sx_cloned.send(Err(error)); - None - } - }; + prompts, + indexer, + embedder.clone(), + &request_threads, + ) { + Ok(results) => Some(results), + Err(error) => { + let _ = lmdb_writer_sx_cloned.send(Err(error)); + None + } + }; if !(remove_vectors.is_empty() && manual_vectors.is_empty() diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index c3b081c37..47f1e9f19 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -252,7 +252,7 @@ where let number_of_documents = self.index.number_of_documents(self.wtxn)?; return Ok(DocumentAdditionResult { indexed_documents: 0, number_of_documents }); } - let mut output = self + let output = self .transform .take() .expect("Invalid document addition state") diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index 6c770c0a1..ae9ae2801 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -400,7 +400,6 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> { { puffin::profile_function!(); - let fields_ids_map = self.index.fields_ids_map(self.wtxn)?; // if the settings are set before any document update, we don't need to do anything, and // will set the primary key during the first document addition. if self.index.number_of_documents(self.wtxn)? == 0 {