Introduce the Typo criterion

This commit is contained in:
Clément Renault 2021-02-19 15:14:00 +01:00 committed by Kerollmops
parent 73286dc8bf
commit f0ddea821c
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -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<Option<(Option<Operation>, 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())
}
}