diff --git a/milli/src/update/new/extract/faceted/mod.rs b/milli/src/update/new/extract/faceted/mod.rs index c885fd610..b54219fd3 100644 --- a/milli/src/update/new/extract/faceted/mod.rs +++ b/milli/src/update/new/extract/faceted/mod.rs @@ -210,7 +210,25 @@ impl FacetedExtractor for FieldIdFacetStringDocidsExtractor { } } -// Extract fieldid facet isnull docids +pub struct FieldIdFacetIsNullDocidsExtractor; +impl FacetedExtractor for FieldIdFacetIsNullDocidsExtractor { + fn attributes_to_extract<'a>(rtxn: &'a RoTxn, index: &'a Index) -> Result> { + index.user_defined_faceted_fields(rtxn) + } + + fn build_key<'b>( + field_id: FieldId, + value: &Value, + output: &'b mut Vec, + ) -> Option<&'b [u8]> { + if value.is_null() { + output.extend_from_slice(&field_id.to_be_bytes()); + Some(&*output) + } else { + None + } + } +} pub struct FieldIdFacetExistsDocidsExtractor; impl FacetedExtractor for FieldIdFacetExistsDocidsExtractor {