Skip to content

Commit

Permalink
added simple docs to FacetCounts now-public API
Browse files Browse the repository at this point in the history
  • Loading branch information
slckl committed Feb 5, 2021
1 parent a482c0e commit 769e9ba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/collector/facet_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ impl<'a> Iterator for FacetChildIterator<'a> {
}

impl FacetCounts {
/// Returns an iterator over all of the facet count pairs inside this result.
/// See the documentation for `FacetCollector` for a usage example.
pub fn get<T>(&self, facet_from: T) -> FacetChildIterator<'_>
where
Facet: From<T>,
Expand All @@ -417,6 +419,8 @@ impl FacetCounts {
FacetChildIterator { underlying }
}

/// Returns a vector of top `k` facets with their counts, sorted highest-to-lowest by counts.
/// See the documentation for `FacetCollector` for a usage example.
pub fn top_k<T>(&self, facet: T, k: usize) -> Vec<(&Facet, u64)>
where
Facet: From<T>,
Expand Down

0 comments on commit 769e9ba

Please sign in to comment.