public class RandomSamplingFacetsCollector extends FacetsCollector
Facetssubclasses to do the facet counting. Note that this collector does not collect the scores of matching docs (i.e.
If you require the original set of hits, you can call
getOriginalMatchingDocs(). Also, since the counts of the top-facets
is based on the sampled set, you can amortize the counts by calling
amortizeFacetCounts(org.apache.lucene.facet.FacetResult, org.apache.lucene.facet.FacetsConfig, org.apache.lucene.search.IndexSearcher).
|Constructor and Description|
Constructor with the given sample size and default seed.
Constructor with the given sample size and seed.
|Modifier and Type||Method and Description|
Note: if you use a counting
Returns the sampled list of the matching documents.
Returns the original matching documents.
Returns the sampling rate that was used.
collect, doSetNextReader, getKeepScores, scoreMode, search, search, search, searchAfter, searchAfter, searchAfter, setScorer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public RandomSamplingFacetsCollector(int sampleSize)
public RandomSamplingFacetsCollector(int sampleSize, long seed)
sampleSize- The preferred sample size. If the number of hits is greater than the size, sampling will be done using a sample ratio of sampling size / totalN. For example: 1000 hits, sample size = 10 results in samplingRatio of 0.01. If the number of hits is lower, no sampling is done at all
seed- The random seed. If
0then a seed will be chosen for you.
public List<FacetsCollector.MatchingDocs> getMatchingDocs()
FacetsCollector.MatchingDocsinstance is returned per segment, even if no hits from that segment are included in the sampled set.
Note: One or more of the MatchingDocs might be empty (not containing any hits) as result of sampling.
MatchingDocs.totalHits is copied from the original
MatchingDocs, scores is set to
public List<FacetsCollector.MatchingDocs> getOriginalMatchingDocs()
public FacetResult amortizeFacetCounts(FacetResult res, FacetsConfig config, IndexSearcher searcher) throws IOException
Facetsimplementation, you can amortize the sampled counts by calling this method. Uses the
IndexSearcherto determine the upper bound for each facet value.
public double getSamplingRate()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.