From b7c77c7a39c3455fbb418fc2f1f6e75143721aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Fri, 30 Aug 2024 10:03:54 +0200 Subject: [PATCH] Use the latest version of the obkv crate --- Cargo.lock | 2 +- milli/src/update/new/mod.rs | 47 ++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e0effa54d..18f6838ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3851,7 +3851,7 @@ dependencies = [ [[package]] name = "obkv" version = "0.3.0" -source = "git+https://github.com/kerollmops/obkv?branch=unsized-kvreader#9c2900d106fa84e7079b288e7f7c366ec7cae948" +source = "git+https://github.com/kerollmops/obkv?branch=unsized-kvreader#ce535874008ecac554f02e0c670e6caf62134d6b" [[package]] name = "once_cell" diff --git a/milli/src/update/new/mod.rs b/milli/src/update/new/mod.rs index 92fcd6b0c..e32290c2b 100644 --- a/milli/src/update/new/mod.rs +++ b/milli/src/update/new/mod.rs @@ -268,9 +268,11 @@ mod indexer { .into()), }?; - /// TODO create a function for this - let current = current.as_bytes().to_vec().into_boxed_slice().into(); - Ok(DocumentChange::Deletion(Deletion::create(docid, external_docid, current))) + Ok(DocumentChange::Deletion(Deletion::create( + docid, + external_docid, + current.boxed(), + ))) }) })) } @@ -483,10 +485,11 @@ mod indexer { if operations.is_empty() { match current { Some(current) => { - /// TODO create a function for this - let current = current.as_bytes().to_vec().into_boxed_slice().into(); - let deletion = Deletion::create(docid, external_docid, current); - return Ok(Some(DocumentChange::Deletion(deletion))); + return Ok(Some(DocumentChange::Deletion(Deletion::create( + docid, + external_docid, + current.boxed(), + )))); } None => return Ok(None), } @@ -511,14 +514,11 @@ mod indexer { let mut writer = KvWriterFieldId::memory(); document.into_iter().for_each(|(id, value)| writer.insert(id, value).unwrap()); - /// TODO create a function for this conversion - let new = writer.into_inner().unwrap().into_boxed_slice().into(); + let new = writer.into_boxed(); match current { Some(current) => { - /// TODO create a function for this conversion - let current = current.as_bytes().to_vec().into_boxed_slice().into(); - let update = Update::create(docid, external_docid, current, new); + let update = Update::create(docid, external_docid, current.boxed(), new); Ok(Some(DocumentChange::Update(update))) } None => { @@ -561,14 +561,11 @@ mod indexer { document_entries .into_iter() .for_each(|(id, value)| writer.insert(id, value).unwrap()); - /// TODO create a function for this conversion - let new = writer.into_inner().unwrap().into_boxed_slice().into(); + let new = writer.into_boxed(); match current { Some(current) => { - /// TODO create a function for this conversion - let current = current.as_bytes().to_vec().into_boxed_slice().into(); - let update = Update::create(docid, external_docid, current, new); + let update = Update::create(docid, external_docid, current.boxed(), new); Ok(Some(DocumentChange::Update(update))) } None => { @@ -577,17 +574,13 @@ mod indexer { } } } - Some(DocumentOperation::Deletion) => { - match current { - Some(current) => { - /// TODO create a function for this conversion - let current = current.as_bytes().to_vec().into_boxed_slice().into(); - let deletion = Deletion::create(docid, external_docid, current); - Ok(Some(DocumentChange::Deletion(deletion))) - } - None => Ok(None), + Some(DocumentOperation::Deletion) => match current { + Some(current) => { + let deletion = Deletion::create(docid, external_docid, current.boxed()); + Ok(Some(DocumentChange::Deletion(deletion))) } - } + None => Ok(None), + }, None => Ok(None), } }