mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
Take into account small Review requests
This commit is contained in:
parent
59f64a5256
commit
63ca25290b
@ -57,12 +57,9 @@ impl<'ctx> DatabaseCache<'ctx> {
|
|||||||
KC: BytesEncode<'v>,
|
KC: BytesEncode<'v>,
|
||||||
DC: BytesDecodeOwned,
|
DC: BytesDecodeOwned,
|
||||||
{
|
{
|
||||||
match cache.entry(cache_key) {
|
if let Entry::Vacant(entry) = cache.entry(cache_key) {
|
||||||
Entry::Occupied(_) => {}
|
let bitmap_ptr = db.get(txn, db_key)?.map(Cow::Borrowed);
|
||||||
Entry::Vacant(entry) => {
|
entry.insert(bitmap_ptr);
|
||||||
let bitmap_ptr = db.get(txn, db_key)?.map(Cow::Borrowed);
|
|
||||||
entry.insert(bitmap_ptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match cache.get(&cache_key).unwrap() {
|
match cache.get(&cache_key).unwrap() {
|
||||||
@ -90,30 +87,27 @@ impl<'ctx> DatabaseCache<'ctx> {
|
|||||||
DC: BytesDecodeOwned,
|
DC: BytesDecodeOwned,
|
||||||
KC::EItem: Sized,
|
KC::EItem: Sized,
|
||||||
{
|
{
|
||||||
match cache.entry(cache_key) {
|
if let Entry::Vacant(entry) = cache.entry(cache_key) {
|
||||||
Entry::Occupied(_) => {}
|
let bitmap_ptr: Option<Cow<'ctx, [u8]>> = match db_keys {
|
||||||
Entry::Vacant(entry) => {
|
[] => None,
|
||||||
let bitmap_ptr: Option<Cow<'ctx, [u8]>> = match db_keys {
|
[key] => db.get(txn, key)?.map(Cow::Borrowed),
|
||||||
[] => None,
|
keys => {
|
||||||
[key] => db.get(txn, key)?.map(Cow::Borrowed),
|
let bitmaps = keys
|
||||||
keys => {
|
.iter()
|
||||||
let bitmaps = keys
|
.filter_map(|key| db.get(txn, key).transpose())
|
||||||
.iter()
|
.map(|v| v.map(Cow::Borrowed))
|
||||||
.filter_map(|key| db.get(txn, key).transpose())
|
.collect::<std::result::Result<Vec<Cow<[u8]>>, _>>()?;
|
||||||
.map(|v| v.map(Cow::Borrowed))
|
|
||||||
.collect::<std::result::Result<Vec<Cow<[u8]>>, _>>()?;
|
|
||||||
|
|
||||||
if bitmaps.is_empty() {
|
if bitmaps.is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(merger(&[], &bitmaps[..])?)
|
Some(merger(&[], &bitmaps[..])?)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
entry.insert(bitmap_ptr);
|
entry.insert(bitmap_ptr);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
match cache.get(&cache_key).unwrap() {
|
match cache.get(&cache_key).unwrap() {
|
||||||
Some(Cow::Borrowed(bytes)) => {
|
Some(Cow::Borrowed(bytes)) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user