Use the latest version of the obkv crate

This commit is contained in:
Clément Renault 2024-08-30 10:03:54 +02:00
parent 0c57cf7565
commit b7c77c7a39
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
2 changed files with 21 additions and 28 deletions

2
Cargo.lock generated
View File

@ -3851,7 +3851,7 @@ dependencies = [
[[package]] [[package]]
name = "obkv" name = "obkv"
version = "0.3.0" 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]] [[package]]
name = "once_cell" name = "once_cell"

View File

@ -268,9 +268,11 @@ mod indexer {
.into()), .into()),
}?; }?;
/// TODO create a function for this Ok(DocumentChange::Deletion(Deletion::create(
let current = current.as_bytes().to_vec().into_boxed_slice().into(); docid,
Ok(DocumentChange::Deletion(Deletion::create(docid, external_docid, current))) external_docid,
current.boxed(),
)))
}) })
})) }))
} }
@ -483,10 +485,11 @@ mod indexer {
if operations.is_empty() { if operations.is_empty() {
match current { match current {
Some(current) => { Some(current) => {
/// TODO create a function for this return Ok(Some(DocumentChange::Deletion(Deletion::create(
let current = current.as_bytes().to_vec().into_boxed_slice().into(); docid,
let deletion = Deletion::create(docid, external_docid, current); external_docid,
return Ok(Some(DocumentChange::Deletion(deletion))); current.boxed(),
))));
} }
None => return Ok(None), None => return Ok(None),
} }
@ -511,14 +514,11 @@ mod indexer {
let mut writer = KvWriterFieldId::memory(); let mut writer = KvWriterFieldId::memory();
document.into_iter().for_each(|(id, value)| writer.insert(id, value).unwrap()); document.into_iter().for_each(|(id, value)| writer.insert(id, value).unwrap());
/// TODO create a function for this conversion let new = writer.into_boxed();
let new = writer.into_inner().unwrap().into_boxed_slice().into();
match current { match current {
Some(current) => { Some(current) => {
/// TODO create a function for this conversion let update = Update::create(docid, external_docid, current.boxed(), new);
let current = current.as_bytes().to_vec().into_boxed_slice().into();
let update = Update::create(docid, external_docid, current, new);
Ok(Some(DocumentChange::Update(update))) Ok(Some(DocumentChange::Update(update)))
} }
None => { None => {
@ -561,14 +561,11 @@ mod indexer {
document_entries document_entries
.into_iter() .into_iter()
.for_each(|(id, value)| writer.insert(id, value).unwrap()); .for_each(|(id, value)| writer.insert(id, value).unwrap());
/// TODO create a function for this conversion let new = writer.into_boxed();
let new = writer.into_inner().unwrap().into_boxed_slice().into();
match current { match current {
Some(current) => { Some(current) => {
/// TODO create a function for this conversion let update = Update::create(docid, external_docid, current.boxed(), new);
let current = current.as_bytes().to_vec().into_boxed_slice().into();
let update = Update::create(docid, external_docid, current, new);
Ok(Some(DocumentChange::Update(update))) Ok(Some(DocumentChange::Update(update)))
} }
None => { None => {
@ -577,17 +574,13 @@ mod indexer {
} }
} }
} }
Some(DocumentOperation::Deletion) => { Some(DocumentOperation::Deletion) => match current {
match current { Some(current) => {
Some(current) => { let deletion = Deletion::create(docid, external_docid, current.boxed());
/// TODO create a function for this conversion Ok(Some(DocumentChange::Deletion(deletion)))
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),
} }
} None => Ok(None),
},
None => Ok(None), None => Ok(None),
} }
} }