mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-08-01 19:30:01 +00:00
Make bucket candidates optionals
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use std::{collections::HashMap, mem};
|
||||
use std::mem::take;
|
||||
|
||||
use log::debug;
|
||||
use roaring::RoaringBitmap;
|
||||
@ -60,13 +60,13 @@ impl<'t> Criterion for Exactness<'t> {
|
||||
self.query_tree = None;
|
||||
},
|
||||
Some(state) => {
|
||||
let (candidates, state) = resolve_state(self.ctx, mem::take(state), &self.query)?;
|
||||
let (candidates, state) = resolve_state(self.ctx, take(state), &self.query)?;
|
||||
self.state = state;
|
||||
|
||||
return Ok(Some(CriterionResult {
|
||||
query_tree: self.query_tree.clone(),
|
||||
candidates: Some(candidates),
|
||||
bucket_candidates: mem::take(&mut self.bucket_candidates),
|
||||
bucket_candidates: Some(take(&mut self.bucket_candidates)),
|
||||
}));
|
||||
},
|
||||
None => {
|
||||
@ -74,11 +74,16 @@ impl<'t> Criterion for Exactness<'t> {
|
||||
Some(CriterionResult { query_tree: Some(query_tree), candidates, bucket_candidates }) => {
|
||||
let candidates = match candidates {
|
||||
Some(candidates) => candidates,
|
||||
None => resolve_query_tree(self.ctx, &query_tree, &mut HashMap::new(), params.wdcache)?,
|
||||
None => resolve_query_tree(self.ctx, &query_tree, params.wdcache)?,
|
||||
};
|
||||
|
||||
match bucket_candidates {
|
||||
Some(bucket_candidates) => self.bucket_candidates |= bucket_candidates,
|
||||
None => self.bucket_candidates |= &candidates,
|
||||
}
|
||||
|
||||
self.state = Some(State::new(candidates));
|
||||
self.query_tree = Some(query_tree);
|
||||
self.bucket_candidates |= bucket_candidates;
|
||||
},
|
||||
Some(CriterionResult { query_tree, candidates, bucket_candidates }) => {
|
||||
return Ok(Some(CriterionResult {
|
||||
|
Reference in New Issue
Block a user