Introduce the FieldIdFacetExistsDocidsExtractor

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

View File

@ -210,9 +210,23 @@ impl FacetedExtractor for FieldIdFacetStringDocidsExtractor {
} }
} }
// Extract fieldid facet isempty docids
// Extract fieldid facet isnull docids // Extract fieldid facet isnull docids
// Extract fieldid facet exists docids
pub struct FieldIdFacetExistsDocidsExtractor;
impl FacetedExtractor for FieldIdFacetExistsDocidsExtractor {
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]> {
output.extend_from_slice(&field_id.to_be_bytes());
Some(&*output)
}
}
pub struct FieldIdFacetIsEmptyDocidsExtractor; pub struct FieldIdFacetIsEmptyDocidsExtractor;
impl FacetedExtractor for FieldIdFacetIsEmptyDocidsExtractor { impl FacetedExtractor for FieldIdFacetIsEmptyDocidsExtractor {