Implements the EXIST filter operator

This commit is contained in:
Loïc Lecrenier 2022-05-25 11:55:16 +02:00
parent a8641b42a7
commit 72452f0cb2
4 changed files with 55 additions and 8 deletions

View file

@ -280,6 +280,25 @@ impl<'a> Filter<'a> {
Condition::LowerThan(val) => (Included(f64::MIN), Excluded(val.parse()?)),
Condition::LowerThanOrEqual(val) => (Included(f64::MIN), Included(val.parse()?)),
Condition::Between { from, to } => (Included(from.parse()?), Included(to.parse()?)),
Condition::Exist => {
let exist = index.exists_faceted_documents_ids(rtxn, field_id)?;
return Ok(exist);
}
Condition::NotExist => {
let all_ids = index.documents_ids(rtxn)?;
let exist = Self::evaluate_operator(
rtxn,
index,
numbers_db,
strings_db,
field_id,
&Condition::Exist,
)?;
let notexist = all_ids - exist;
return Ok(notexist);
}
Condition::Equal(val) => {
let (_original_value, string_docids) = strings_db
.get(rtxn, &(field_id, &val.value().to_lowercase()))?