mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 18:45:06 +08:00
Make facet string iterator non reducing
This commit is contained in:
parent
8fdf860c17
commit
7dbefae1e3
@ -289,6 +289,7 @@ pub struct FacetStringIter<'t> {
|
|||||||
field_id: FieldId,
|
field_id: FieldId,
|
||||||
level_iters:
|
level_iters:
|
||||||
Vec<(RoaringBitmap, Either<FacetStringGroupRange<'t>, FacetStringLevelZeroRange<'t>>)>,
|
Vec<(RoaringBitmap, Either<FacetStringGroupRange<'t>, FacetStringLevelZeroRange<'t>>)>,
|
||||||
|
must_reduce: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'t> FacetStringIter<'t> {
|
impl<'t> FacetStringIter<'t> {
|
||||||
@ -318,7 +319,13 @@ impl<'t> FacetStringIter<'t> {
|
|||||||
)?),
|
)?),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(FacetStringIter { rtxn, db, field_id, level_iters: vec![(documents_ids, highest_iter)] })
|
Ok(FacetStringIter {
|
||||||
|
rtxn,
|
||||||
|
db,
|
||||||
|
field_id,
|
||||||
|
level_iters: vec![(documents_ids, highest_iter)],
|
||||||
|
must_reduce: false,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn highest_level<X, Y>(
|
fn highest_level<X, Y>(
|
||||||
@ -348,7 +355,9 @@ impl<'t> Iterator for FacetStringIter<'t> {
|
|||||||
Ok(((level, left, right), (string_bounds, mut docids))) => {
|
Ok(((level, left, right), (string_bounds, mut docids))) => {
|
||||||
docids &= &*documents_ids;
|
docids &= &*documents_ids;
|
||||||
if !docids.is_empty() {
|
if !docids.is_empty() {
|
||||||
*documents_ids -= &docids;
|
if self.must_reduce {
|
||||||
|
*documents_ids -= &docids;
|
||||||
|
}
|
||||||
|
|
||||||
let result = match string_bounds {
|
let result = match string_bounds {
|
||||||
Some((left, right)) => FacetStringLevelZeroRange::new(
|
Some((left, right)) => FacetStringLevelZeroRange::new(
|
||||||
@ -390,7 +399,9 @@ impl<'t> Iterator for FacetStringIter<'t> {
|
|||||||
Ok((normalized, original, mut docids)) => {
|
Ok((normalized, original, mut docids)) => {
|
||||||
docids &= &*documents_ids;
|
docids &= &*documents_ids;
|
||||||
if !docids.is_empty() {
|
if !docids.is_empty() {
|
||||||
*documents_ids -= &docids;
|
if self.must_reduce {
|
||||||
|
*documents_ids -= &docids;
|
||||||
|
}
|
||||||
return Some(Ok((normalized, original, docids)));
|
return Some(Ok((normalized, original, docids)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user