MeiliSearch/milli/src/search/criteria/initial.rs

32 lines
778 B
Rust
Raw Normal View History

2021-03-23 15:25:46 +01:00
use roaring::RoaringBitmap;
2021-06-16 18:33:33 +02:00
use super::{Criterion, CriterionParameters, CriterionResult};
2021-03-23 15:25:46 +01:00
use crate::search::query_tree::Operation;
2021-06-16 18:33:33 +02:00
use crate::Result;
2021-03-23 15:25:46 +01:00
pub struct Initial {
2021-06-16 18:33:33 +02:00
answer: Option<CriterionResult>,
2021-03-23 15:25:46 +01:00
}
impl Initial {
2021-06-16 18:33:33 +02:00
pub fn new(
query_tree: Option<Operation>,
filtered_candidates: Option<RoaringBitmap>,
) -> Initial {
2021-03-23 15:25:46 +01:00
let answer = CriterionResult {
query_tree,
2021-05-10 12:33:37 +02:00
candidates: None,
filtered_candidates,
2021-05-05 20:46:56 +02:00
bucket_candidates: None,
2021-03-23 15:25:46 +01:00
};
Initial { answer: Some(answer) }
}
}
impl Criterion for Initial {
#[logging_timer::time("Initial::{}")]
fn next(&mut self, _: &mut CriterionParameters) -> Result<Option<CriterionResult>> {
2021-03-23 15:25:46 +01:00
Ok(self.answer.take())
}
}