From 49fa41ce6590862be2b0739c343c0b78861c5d97 Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 5 Jun 2024 12:09:14 +0200 Subject: [PATCH] apply first round of review comments --- index-scheduler/src/lib.rs | 2 -- meilisearch/src/search.rs | 10 ++++------ meilisearch/tests/dumps/mod.rs | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 57eccbe66..f98e419a1 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -5172,9 +5172,7 @@ mod tests { snapshot!(snapshot_index_scheduler(&index_scheduler), name: "Intel to kefir"); - println!("HEEEEERE"); handle.advance_one_successful_batch(); - // handle.advance_one_failed_batch(); snapshot!(snapshot_index_scheduler(&index_scheduler), name: "Intel to kefir succeeds"); { diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index 9b72ed596..c749dff86 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -1073,12 +1073,10 @@ fn make_hits( .is_some_and(|conf| conf.user_defined.contains(id)); let mut embedding = serde_json::Map::new(); embedding.insert("userDefined".to_string(), user_defined.into()); - if vector.len() == 1 { - let vector = vector.pop().unwrap(); - embedding.insert("embedding".to_string(), vector.into()); - } else { - embedding.insert("embedding".to_string(), vector.into()); - } + match vector.as_mut_slice() { + [one] => embedding.insert("embedding".to_string(), std::mem::take(one).into()), + _ => embedding.insert("embedding".to_string(), vector.into()), + }; vectors.insert(name, embedding.into()); } document.insert("_vectors".into(), vectors.into()); diff --git a/meilisearch/tests/dumps/mod.rs b/meilisearch/tests/dumps/mod.rs index dfac2e806..b657fc1ee 100644 --- a/meilisearch/tests/dumps/mod.rs +++ b/meilisearch/tests/dumps/mod.rs @@ -1993,7 +1993,7 @@ async fn generate_and_import_dump_containing_vectors() { let response = index.wait_task(response.uid()).await; snapshot!(response["status"], @r###""succeeded""###); - // ========= We made a dump, now we should clear the DB except and try to import our dump + // ========= We made a dump, now we should clear the DB and try to import our dump drop(server); tokio::fs::remove_dir_all(&opt.db_path).await.unwrap(); let dump_name = format!("{}.dump", response["details"]["dumpUid"].as_str().unwrap());