Introduce the NULL and NOT value NULL operator

This commit is contained in:
Clément Renault 2023-03-08 16:57:42 +01:00
parent 43ff236df8
commit 7c0cd7172d
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
4 changed files with 48 additions and 4 deletions

View file

@ -839,6 +839,18 @@ impl Index {
}
}
/// Retrieve all the documents which contain this field id set as null
pub fn null_faceted_documents_ids(
&self,
rtxn: &RoTxn,
field_id: FieldId,
) -> heed::Result<RoaringBitmap> {
match self.facet_id_is_null_docids.get(rtxn, &BEU16::new(field_id))? {
Some(docids) => Ok(docids),
None => Ok(RoaringBitmap::new()),
}
}
/// Retrieve all the documents which contain this field id
pub fn exists_faceted_documents_ids(
&self,

View file

@ -219,6 +219,10 @@ impl<'a> Filter<'a> {
Condition::Between { from, to } => {
(Included(from.parse_finite_float()?), Included(to.parse_finite_float()?))
}
Condition::Null => {
let is_null = index.null_faceted_documents_ids(rtxn, field_id)?;
return Ok(is_null);
}
Condition::Exists => {
let exist = index.exists_faceted_documents_ids(rtxn, field_id)?;
return Ok(exist);