Introduce the FieldIdFacetIsNullDocidsExtractor

This commit is contained in:
Clément Renault 2024-09-04 17:50:08 +02:00
parent 9c0a1cd9fd
commit b33ec9ba3f
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -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<HashSet<String>> {
index.user_defined_faceted_fields(rtxn)
}
fn build_key<'b>(
field_id: FieldId,
value: &Value,
output: &'b mut Vec<u8>,
) -> 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 {