mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Document and refine facet indexing algorithms
This commit is contained in:
parent
bee3c23b45
commit
27454e9828
5 changed files with 387 additions and 291 deletions
|
@ -29,31 +29,14 @@ pub fn try_split_at(slice: &[u8], mid: usize) -> Option<(&[u8], &[u8])> {
|
|||
}
|
||||
}
|
||||
|
||||
/// The key in the [`facet_id_string_docids` and `facet_id_f64_docids`][`Index::facet_id_string_docids`]
|
||||
/// databases.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct FacetGroupKey<T> {
|
||||
pub field_id: u16,
|
||||
pub level: u8,
|
||||
pub left_bound: T,
|
||||
}
|
||||
impl<'a> FacetGroupKey<&'a [u8]> {
|
||||
pub fn into_owned(self) -> FacetGroupKey<Vec<u8>> {
|
||||
FacetGroupKey {
|
||||
field_id: self.field_id,
|
||||
level: self.level,
|
||||
left_bound: self.left_bound.to_vec(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FacetGroupKey<Vec<u8>> {
|
||||
pub fn as_ref(&self) -> FacetGroupKey<&[u8]> {
|
||||
FacetGroupKey {
|
||||
field_id: self.field_id,
|
||||
level: self.level,
|
||||
left_bound: self.left_bound.as_slice(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FacetGroupValue {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue