/// For each entry in facet_docids, calculates the number of documents in the intersection with candidate_docids.
For each entry in facet_docids, calculates the number of documents in the intersection with candidate_docids.
For each entry in facet_docids calculates the number of documents in the intersection with candidate_docids .
fn facet_count(
    facet_docids: HashMap<String, HashMap<String, Cow<Set<DocumentId>>>>,
    candidate_docids: &Set<DocumentId>,
) -> HashMap<String, HashMap<String, usize>> {
    let mut facets_counts = HashMap::with_capacity(facet_docids.len());
    for (key, doc_map) in facet_docids {
        let mut count_map = HashMap::with_capacity(doc_map.len());
        for (value, docids) in doc_map {
            let mut counter = Counter::new();
            let op = OpBuilder::new(docids.as_ref(), candidate_docids).intersection();
            SetOperation::<DocumentId>::extend_collection(op, &mut counter);
            count_map.insert(value, counter.0);
        }
        facets_counts.insert(key, count_map);
    }
    facets_counts
}
fn facet_count ( facet_docids : HashMap < String , HashMap < String , Cow < Set < DocumentId > > > > , candidate_docids : & Set < DocumentId > , ) -> HashMap < String , HashMap < String , usize > > { let mut facets_counts = HashMap :: with_capacity ( facet_docids . len ( ) ) ; for ( key , doc_map ) in facet_docids { let mut count_map = HashMap :: with_capacity ( doc_map . len ( ) ) ; for ( value , docids ) in doc_map { let mut counter = Counter :: new ( ) ; let op = OpBuilder :: new ( docids . as_ref ( ) , candidate_docids ) . intersection ( ) ; SetOperation :: < DocumentId > :: extend_collection ( op , & mut counter ) ; count_map . insert ( value , counter . 0 ) ; } facets_counts . insert ( key , count_map ) ; } facets_counts }
For each entry in facet_docids, calculates the number of documents in the intersection with candidate_docids.
For each entry in facet_docids calculates the number of documents in the intersection with candidate_docids .
facet_docids
HashMap<String, HashMap<String, Cow<Set<DocumentId>>>>
candidate_docids
&Set<DocumentId>