mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
Reintroduce db_snap! for facet databases
This commit is contained in:
parent
e570c23153
commit
fb8d23deb3
@ -6,6 +6,7 @@ use heed::types::ByteSlice;
|
|||||||
use heed::BytesDecode;
|
use heed::BytesDecode;
|
||||||
use roaring::RoaringBitmap;
|
use roaring::RoaringBitmap;
|
||||||
|
|
||||||
|
use crate::heed_codec::facet::new::{FacetGroupValue, FacetKey};
|
||||||
use crate::heed_codec::facet::FacetStringZeroBoundsValueCodec;
|
use crate::heed_codec::facet::FacetStringZeroBoundsValueCodec;
|
||||||
use crate::{make_db_snap_from_iter, CboRoaringBitmapCodec, ExternalDocumentsIds, Index};
|
use crate::{make_db_snap_from_iter, CboRoaringBitmapCodec, ExternalDocumentsIds, Index};
|
||||||
|
|
||||||
@ -229,48 +230,22 @@ pub fn snap_word_prefix_position_docids(index: &Index) -> String {
|
|||||||
snap
|
snap
|
||||||
}
|
}
|
||||||
pub fn snap_facet_id_f64_docids(index: &Index) -> String {
|
pub fn snap_facet_id_f64_docids(index: &Index) -> String {
|
||||||
todo!()
|
let snap = make_db_snap_from_iter!(index, facet_id_f64_docids, |(
|
||||||
// let snap = make_db_snap_from_iter!(index, facet_id_f64_docids, |(
|
FacetKey { field_id, level, left_bound },
|
||||||
// (facet_id, level, left, right),
|
FacetGroupValue { size, bitmap },
|
||||||
// b,
|
)| {
|
||||||
// )| {
|
&format!("{field_id:<3} {level:<2} {left_bound:<6} {size:<2} {}", display_bitmap(&bitmap))
|
||||||
// &format!("{facet_id:<3} {level:<2} {left:<6} {right:<6} {}", display_bitmap(&b))
|
});
|
||||||
// });
|
snap
|
||||||
// snap
|
|
||||||
}
|
}
|
||||||
pub fn snap_facet_id_string_docids(index: &Index) -> String {
|
pub fn snap_facet_id_string_docids(index: &Index) -> String {
|
||||||
todo!()
|
let snap = make_db_snap_from_iter!(index, facet_id_string_docids, |(
|
||||||
// let rtxn = index.read_txn().unwrap();
|
FacetKey { field_id, level, left_bound },
|
||||||
// let bytes_db = index.facet_id_string_docids.remap_types::<ByteSlice, ByteSlice>();
|
FacetGroupValue { size, bitmap },
|
||||||
// let iter = bytes_db.iter(&rtxn).unwrap();
|
)| {
|
||||||
// let mut snap = String::new();
|
&format!("{field_id:<3} {level:<2} {left_bound:<12} {size:<2} {}", display_bitmap(&bitmap))
|
||||||
|
});
|
||||||
// for x in iter {
|
snap
|
||||||
// let (key, value) = x.unwrap();
|
|
||||||
// if let Some((field_id, normalized_str)) = FacetStringLevelZeroCodec::bytes_decode(key) {
|
|
||||||
// let (orig_string, docids) =
|
|
||||||
// FacetStringLevelZeroValueCodec::bytes_decode(value).unwrap();
|
|
||||||
// snap.push_str(&format!(
|
|
||||||
// "{field_id:<3} {normalized_str:<8} {orig_string:<8} {}\n",
|
|
||||||
// display_bitmap(&docids)
|
|
||||||
// ));
|
|
||||||
// } else if let Some((field_id, level, left, right)) =
|
|
||||||
// FacetLevelValueU32Codec::bytes_decode(key)
|
|
||||||
// {
|
|
||||||
// snap.push_str(&format!("{field_id:<3} {level:<2} {left:<6} {right:<6} "));
|
|
||||||
// let (bounds, docids) =
|
|
||||||
// FacetStringZeroBoundsValueCodec::<CboRoaringBitmapCodec>::bytes_decode(value)
|
|
||||||
// .unwrap();
|
|
||||||
// if let Some((left, right)) = bounds {
|
|
||||||
// snap.push_str(&format!("{left:<8} {right:<8} "));
|
|
||||||
// }
|
|
||||||
// snap.push_str(&display_bitmap(&docids));
|
|
||||||
// snap.push('\n');
|
|
||||||
// } else {
|
|
||||||
// panic!();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// snap
|
|
||||||
}
|
}
|
||||||
pub fn snap_documents_ids(index: &Index) -> String {
|
pub fn snap_documents_ids(index: &Index) -> String {
|
||||||
let rtxn = index.read_txn().unwrap();
|
let rtxn = index.read_txn().unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user