diff --git a/milli/src/search/criteria/mod.rs b/milli/src/search/criteria/mod.rs new file mode 100644 index 000000000..4cc4512d7 --- /dev/null +++ b/milli/src/search/criteria/mod.rs @@ -0,0 +1,34 @@ +use crate::Index; + +use roaring::RoaringBitmap; + +use super::query_tree::Operation; + +pub mod typo; + +pub trait Criterion { + fn next(&mut self) -> anyhow::Result, RoaringBitmap)>>; +} + +/// Either a set of candidates that defines the candidates +/// that are allowed to be returned, +/// or the candidates that must never be returned. +enum Candidates { + Allowed(RoaringBitmap), + Forbidden(RoaringBitmap) +} + +impl Candidates { + fn into_inner(self) -> RoaringBitmap { + match self { + Self::Allowed(inner) => inner, + Self::Forbidden(inner) => inner, + } + } +} + +impl Default for Candidates { + fn default() -> Self { + Self::Forbidden(RoaringBitmap::new()) + } +}