Fix the bucket candidates

This commit is contained in:
Kerollmops 2021-03-09 15:55:59 +01:00
parent 42fd7dea78
commit facfb4b615
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
3 changed files with 13 additions and 8 deletions

View File

@ -175,6 +175,11 @@ impl<'t> Criterion for AscDesc<'t> {
}, },
(None, None) => take(&mut self.faceted_candidates), (None, None) => take(&mut self.faceted_candidates),
}; };
if bucket_candidates.is_empty() {
self.bucket_candidates.union_with(&candidates);
} else {
self.bucket_candidates.union_with(&bucket_candidates);
}
self.candidates = facet_ordered( self.candidates = facet_ordered(
self.index, self.index,
self.rtxn, self.rtxn,
@ -183,7 +188,6 @@ impl<'t> Criterion for AscDesc<'t> {
self.ascending, self.ascending,
candidates, candidates,
)?; )?;
self.bucket_candidates = bucket_candidates;
}, },
None => return Ok(None), None => return Ok(None),
} }

View File

@ -179,10 +179,15 @@ impl<'t> Criterion for Proximity<'t> {
(None, None) => RoaringBitmap::new(), (None, None) => RoaringBitmap::new(),
}; };
if bucket_candidates.is_empty() {
self.bucket_candidates.union_with(&candidates);
} else {
self.bucket_candidates.union_with(&bucket_candidates);
}
self.query_tree = query_tree.map(|op| (maximum_proximity(&op), op)); self.query_tree = query_tree.map(|op| (maximum_proximity(&op), op));
self.proximity = 0; self.proximity = 0;
self.candidates = Candidates::Allowed(candidates); self.candidates = Candidates::Allowed(candidates);
self.bucket_candidates.union_with(&bucket_candidates);
self.plane_sweep_cache = None; self.plane_sweep_cache = None;
}, },
None => return Ok(None), None => return Ok(None),

View File

@ -127,16 +127,12 @@ impl<'t> Criterion for Typo<'t> {
new_candidates.difference_with(&candidates); new_candidates.difference_with(&candidates);
candidates.union_with(&new_candidates); candidates.union_with(&new_candidates);
self.number_typos += 1; self.number_typos += 1;
self.bucket_candidates.union_with(&new_candidates);
let bucket_candidates = match self.parent {
Some(_) => take(&mut self.bucket_candidates),
None => new_candidates.clone(),
};
return Ok(Some(CriterionResult { return Ok(Some(CriterionResult {
query_tree: Some(new_query_tree), query_tree: Some(new_query_tree),
candidates: Some(new_candidates), candidates: Some(new_candidates),
bucket_candidates, bucket_candidates: take(&mut self.bucket_candidates),
})); }));
} }
}, },