remove option on bucket_candidates

This commit is contained in:
many 2021-02-25 16:47:34 +01:00 committed by Kerollmops
parent 14f9f85c4b
commit 3d731cc861
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -21,7 +21,7 @@ pub struct AscDesc<'t> {
ascending: bool, ascending: bool,
query_tree: Option<Operation>, query_tree: Option<Operation>,
candidates: Candidates, candidates: Candidates,
bucket_candidates: Option<RoaringBitmap>, bucket_candidates: RoaringBitmap,
faceted_candidates: RoaringBitmap, faceted_candidates: RoaringBitmap,
parent: Option<Box<dyn Criterion + 't>>, parent: Option<Box<dyn Criterion + 't>>,
} }
@ -92,7 +92,7 @@ impl<'t> AscDesc<'t> {
query_tree, query_tree,
candidates: candidates.map_or_else(Candidates::default, Candidates::Allowed), candidates: candidates.map_or_else(Candidates::default, Candidates::Allowed),
faceted_candidates: index.faceted_documents_ids(rtxn, field_id)?, faceted_candidates: index.faceted_documents_ids(rtxn, field_id)?,
bucket_candidates: None, bucket_candidates: RoaringBitmap::new(),
parent: None, parent: None,
}) })
} }
@ -115,7 +115,7 @@ impl<'t> AscDesc<'t> {
query_tree: None, query_tree: None,
candidates: Candidates::default(), candidates: Candidates::default(),
faceted_candidates: index.faceted_documents_ids(rtxn, field_id)?, faceted_candidates: index.faceted_documents_ids(rtxn, field_id)?,
bucket_candidates: None, bucket_candidates: RoaringBitmap::new(),
parent: Some(parent), parent: Some(parent),
}) })
} }
@ -133,8 +133,8 @@ impl<'t> Criterion for AscDesc<'t> {
}, },
(Some(qt), Allowed(candidates)) => { (Some(qt), Allowed(candidates)) => {
let bucket_candidates = match self.parent { let bucket_candidates = match self.parent {
Some(_) => self.bucket_candidates.take(), Some(_) => take(&mut self.bucket_candidates),
None => Some(candidates.clone()), None => candidates.clone(),
}; };
let mut found_candidates = facet_ordered( let mut found_candidates = facet_ordered(
@ -163,7 +163,7 @@ impl<'t> Criterion for AscDesc<'t> {
return Ok(Some(CriterionResult { return Ok(Some(CriterionResult {
query_tree: None, query_tree: None,
candidates: candidates.clone(), candidates: candidates.clone(),
bucket_candidates: Some(candidates), bucket_candidates: candidates,
})); }));
}, },
(None, Forbidden(_)) => { (None, Forbidden(_)) => {