mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
implement initial state for words criterion
This commit is contained in:
parent
3415812b06
commit
b5b7ec0162
@ -60,23 +60,36 @@ impl<'t> Criterion for Words<'t> {
|
|||||||
self.candidates = Candidates::default();
|
self.candidates = Candidates::default();
|
||||||
},
|
},
|
||||||
(Some(qt), Allowed(candidates)) => {
|
(Some(qt), Allowed(candidates)) => {
|
||||||
let bucket_candidates = match self.parent {
|
|
||||||
Some(_) => take(&mut self.bucket_candidates),
|
|
||||||
None => candidates.clone(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut found_candidates = resolve_candidates(self.ctx, &qt, &mut self.candidates_cache)?;
|
let mut found_candidates = resolve_candidates(self.ctx, &qt, &mut self.candidates_cache)?;
|
||||||
found_candidates.intersect_with(&candidates);
|
found_candidates.intersect_with(&candidates);
|
||||||
candidates.difference_with(&found_candidates);
|
candidates.difference_with(&found_candidates);
|
||||||
|
|
||||||
|
let bucket_candidates = match self.parent {
|
||||||
|
Some(_) => take(&mut self.bucket_candidates),
|
||||||
|
None => found_candidates.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
return Ok(Some(CriterionResult {
|
return Ok(Some(CriterionResult {
|
||||||
query_tree: Some(qt),
|
query_tree: Some(qt),
|
||||||
candidates: found_candidates,
|
candidates: found_candidates,
|
||||||
bucket_candidates,
|
bucket_candidates,
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
(Some(_qt), Forbidden(_candidates)) => {
|
(Some(qt), Forbidden(candidates)) => {
|
||||||
todo!()
|
let mut found_candidates = resolve_candidates(self.ctx, &qt, &mut self.candidates_cache)?;
|
||||||
|
found_candidates.difference_with(&candidates);
|
||||||
|
candidates.union_with(&found_candidates);
|
||||||
|
|
||||||
|
let bucket_candidates = match self.parent {
|
||||||
|
Some(_) => take(&mut self.bucket_candidates),
|
||||||
|
None => found_candidates.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
return Ok(Some(CriterionResult {
|
||||||
|
query_tree: Some(qt),
|
||||||
|
candidates: found_candidates,
|
||||||
|
bucket_candidates,
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
(None, Allowed(_)) => {
|
(None, Allowed(_)) => {
|
||||||
let candidates = take(&mut self.candidates).into_inner();
|
let candidates = take(&mut self.candidates).into_inner();
|
||||||
|
Loading…
Reference in New Issue
Block a user