mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-10-11 06:06:32 +00:00
Patch the CBO roaring encoders to use the main branch
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -5168,8 +5168,7 @@ checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "roaring"
|
name = "roaring"
|
||||||
version = "0.10.12"
|
version = "0.10.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/RoaringBitmap/roaring-rs.git#6535a822358fce546eb021da8b02d52e4906fe7a"
|
||||||
checksum = "19e8d2cfa184d94d0726d650a9f4a1be7f9b76ac9fdb954219878dc00c1c1e7b"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
@@ -49,3 +49,6 @@ opt-level = 3
|
|||||||
opt-level = 3
|
opt-level = 3
|
||||||
[profile.dev.package.roaring]
|
[profile.dev.package.roaring]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
roaring = { git = "https://github.com/RoaringBitmap/roaring-rs.git" }
|
||||||
|
@@ -43,8 +43,10 @@ impl heed::BytesEncode<'_> for BoRoaringBitmapCodec {
|
|||||||
type EItem = RoaringBitmap;
|
type EItem = RoaringBitmap;
|
||||||
|
|
||||||
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
|
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
|
||||||
|
let mut item = item.clone();
|
||||||
|
item.optimize();
|
||||||
let mut out = Vec::new();
|
let mut out = Vec::new();
|
||||||
BoRoaringBitmapCodec::serialize_into(item, &mut out);
|
BoRoaringBitmapCodec::serialize_into(&item, &mut out);
|
||||||
Ok(Cow::Owned(out))
|
Ok(Cow::Owned(out))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ use crate::update::del_add::{DelAdd, KvReaderDelAdd};
|
|||||||
/// This is the limit where using a byteorder became less size efficient
|
/// This is the limit where using a byteorder became less size efficient
|
||||||
/// than using a direct roaring encoding, it is also the point where we are able
|
/// than using a direct roaring encoding, it is also the point where we are able
|
||||||
/// to determine the encoding used only by using the array of bytes length.
|
/// to determine the encoding used only by using the array of bytes length.
|
||||||
pub const THRESHOLD: usize = 7;
|
pub const THRESHOLD: usize = 3;
|
||||||
|
|
||||||
/// A conditionnal codec that either use the RoaringBitmap
|
/// A conditionnal codec that either use the RoaringBitmap
|
||||||
/// or a lighter ByteOrder en/decoding method.
|
/// or a lighter ByteOrder en/decoding method.
|
||||||
@@ -177,8 +177,10 @@ impl heed::BytesEncode<'_> for CboRoaringBitmapCodec {
|
|||||||
type EItem = RoaringBitmap;
|
type EItem = RoaringBitmap;
|
||||||
|
|
||||||
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
|
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
|
||||||
let mut vec = Vec::with_capacity(Self::serialized_size(item));
|
let mut item = item.clone();
|
||||||
Self::serialize_into_vec(item, &mut vec);
|
item.optimize();
|
||||||
|
let mut vec = Vec::with_capacity(Self::serialized_size(&item));
|
||||||
|
Self::serialize_into_vec(&item, &mut vec);
|
||||||
Ok(Cow::Owned(vec))
|
Ok(Cow::Owned(vec))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,8 @@ impl heed::BytesEncode<'_> for RoaringBitmapCodec {
|
|||||||
type EItem = RoaringBitmap;
|
type EItem = RoaringBitmap;
|
||||||
|
|
||||||
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
|
fn bytes_encode(item: &Self::EItem) -> Result<Cow<'_, [u8]>, BoxedError> {
|
||||||
|
let mut item = item.clone();
|
||||||
|
item.optimize();
|
||||||
let mut bytes = Vec::with_capacity(item.serialized_size());
|
let mut bytes = Vec::with_capacity(item.serialized_size());
|
||||||
item.serialize_into(&mut bytes)?;
|
item.serialize_into(&mut bytes)?;
|
||||||
Ok(Cow::Owned(bytes))
|
Ok(Cow::Owned(bytes))
|
||||||
|
Reference in New Issue
Block a user