Implement the simplified NOT operator

This commit is contained in:
Loïc Lecrenier 2022-06-14 15:15:05 +02:00
parent 01675771d5
commit 44744d9e67
2 changed files with 14 additions and 19 deletions

View file

@ -360,6 +360,16 @@ impl<'a> Filter<'a> {
filterable_fields: &HashSet<String>,
) -> Result<RoaringBitmap> {
match &self.condition {
FilterCondition::Not(f) => {
let all_ids = index.documents_ids(rtxn)?;
let selected = Self::inner_evaluate(
&(f.as_ref().clone()).into(),
rtxn,
index,
filterable_fields,
)?;
return Ok(all_ids - selected);
}
FilterCondition::Condition { fid, op } => {
if crate::is_faceted(fid.value(), filterable_fields) {
let field_ids_map = index.fields_ids_map(rtxn)?;