mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 01:57:41 +08:00
Introduce the FieldIdFacetIsEmptyDocidsExtractor
This commit is contained in:
parent
19d937ab21
commit
0b061f1e70
@ -186,7 +186,6 @@ impl FacetedExtractor for FieldIdFacetNumberDocidsExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO It doesn't keep the original string in the value
|
||||
pub struct FieldIdFacetStringDocidsExtractor;
|
||||
impl FacetedExtractor for FieldIdFacetStringDocidsExtractor {
|
||||
fn attributes_to_extract<'a>(rtxn: &'a RoTxn, index: &'a Index) -> Result<HashSet<String>> {
|
||||
@ -211,6 +210,37 @@ impl FacetedExtractor for FieldIdFacetStringDocidsExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
// Extract fieldid facet isempty docids
|
||||
// Extract fieldid facet isnull docids
|
||||
// Extract fieldid facet exists docids
|
||||
|
||||
pub struct FieldIdFacetIsEmptyDocidsExtractor;
|
||||
impl FacetedExtractor for FieldIdFacetIsEmptyDocidsExtractor {
|
||||
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]> {
|
||||
let is_empty = match value {
|
||||
Value::Null | Value::Bool(_) | Value::Number(_) => false,
|
||||
Value::String(s) => s.is_empty(),
|
||||
Value::Array(a) => a.is_empty(),
|
||||
Value::Object(o) => o.is_empty(),
|
||||
};
|
||||
|
||||
if is_empty {
|
||||
output.extend_from_slice(&field_id.to_be_bytes());
|
||||
Some(&*output)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn extract_document_facets(
|
||||
attributes_to_extract: &[&str],
|
||||
obkv: &KvReaderFieldId,
|
||||
|
@ -131,7 +131,9 @@ where
|
||||
// Extract fieldid docid facet number
|
||||
// Extract fieldid docid facet string
|
||||
// Extract facetid string fst
|
||||
// Extract facetid normalized string strings
|
||||
|
||||
// TODO Inverted Indexes again
|
||||
// Extract fieldid facet isempty docids
|
||||
// Extract fieldid facet isnull docids
|
||||
// Extract fieldid facet exists docids
|
||||
|
Loading…
Reference in New Issue
Block a user