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]]
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"

View File

@ -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),
}
}