Class RandomSamplingFacetsCollector
Collects hits for subsequent faceting, using sampling if needed. Once you've
run a search and collect hits into this, instantiate one of the
Facets subclasses to do the facet counting. Note that this collector
does not collect the scores of matching docs (i.e.
Scores) is null
.
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(FacetResult, FacetsConfig, IndexSearcher).
Implements
Inherited Members
Namespace: Lucene.Net.Facet
Assembly: Lucene.Net.Facet.dll
Syntax
public class RandomSamplingFacetsCollector : FacetsCollector, ICollector
Constructors
| Improve this Doc View SourceRandomSamplingFacetsCollector(Int32)
Constructor with the given sample size and default seed.
Declaration
public RandomSamplingFacetsCollector(int sampleSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | sampleSize |
See Also
| Improve this Doc View SourceRandomSamplingFacetsCollector(Int32, Int64)
Constructor with the given sample size and seed.
Declaration
public RandomSamplingFacetsCollector(int sampleSize, long seed)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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 |
System.Int64 | seed | The random seed. If |
Properties
| Improve this Doc View SourceSamplingRate
Returns the sampling rate that was used.
Declaration
public virtual double SamplingRate { get; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
| Improve this Doc View SourceAmortizeFacetCounts(FacetResult, FacetsConfig, IndexSearcher)
Note: if you use a counting Facets implementation, you can amortize the sampled counts by calling this method. Uses the FacetsConfig and the IndexSearcher to determine the upper bound for each facet value.
Declaration
public virtual FacetResult AmortizeFacetCounts(FacetResult res, FacetsConfig config, IndexSearcher searcher)
Parameters
Type | Name | Description |
---|---|---|
FacetResult | res | |
FacetsConfig | config | |
IndexSearcher | searcher |
Returns
Type | Description |
---|---|
FacetResult |
GetMatchingDocs()
Returns the sampled list of the matching documents. Note that a FacetsCollector.MatchingDocs instance is returned per segment, even if no hits from that segment are included in the sampled set.
Note: One or more of the FacetsCollector.MatchingDocs might be empty (not containing any hits) as result of sampling.
Note: TotalHits is copied from the original
FacetsCollector.MatchingDocs, scores is set to null
Declaration
public override IList<FacetsCollector.MatchingDocs> GetMatchingDocs()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<FacetsCollector.MatchingDocs> |
Overrides
| Improve this Doc View SourceGetOriginalMatchingDocs()
Returns the original matching documents.
Declaration
public virtual IList<FacetsCollector.MatchingDocs> GetOriginalMatchingDocs()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<FacetsCollector.MatchingDocs> |