mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-03-16 05:41:47 +08:00
- pass excluded document to criteria to remove them in higher levels of the bucket-sort - merge already returned document with excluded documents to avoid duplicas Related to #125 and #112 Fix #170
28 lines
753 B
Rust
28 lines
753 B
Rust
use roaring::RoaringBitmap;
|
|
|
|
use crate::search::query_tree::Operation;
|
|
|
|
use super::{Criterion, CriterionResult, CriterionParameters};
|
|
|
|
pub struct Initial {
|
|
answer: Option<CriterionResult>
|
|
}
|
|
|
|
impl Initial {
|
|
pub fn new(query_tree: Option<Operation>, mut candidates: Option<RoaringBitmap>) -> Initial {
|
|
let answer = CriterionResult {
|
|
query_tree,
|
|
candidates: candidates.clone(),
|
|
bucket_candidates: candidates.take().unwrap_or_default(),
|
|
};
|
|
Initial { answer: Some(answer) }
|
|
}
|
|
}
|
|
|
|
impl Criterion for Initial {
|
|
#[logging_timer::time("Initial::{}")]
|
|
fn next(&mut self, _: &mut CriterionParameters) -> anyhow::Result<Option<CriterionResult>> {
|
|
Ok(self.answer.take())
|
|
}
|
|
}
|