|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.facet.search.sampling.Sampler
public class Sampler
Sampling definition for facets accumulation
The Sampler uses TAKMI style counting to provide a 'best guess' top-K result set of the facets accumulated.
Note: Sampling accumulation (Accumulation over a sampled-set of the results),
does not guarantee accurate values for
FacetResult.getNumValidDescendants()
&
FacetResultNode.getResidue()
.
Nested Class Summary | |
---|---|
static class |
Sampler.SampleResult
Result of sample computation |
Constructor Summary | |
---|---|
Sampler()
Construct with SamplingParams |
|
Sampler(SamplingParams params)
Construct with certain SamplingParams |
Method Summary | |
---|---|
SampleFixer |
getSampleFixer(org.apache.lucene.index.IndexReader indexReader,
TaxonomyReader taxonomyReader,
FacetSearchParams searchParams)
Get a fixer of sample facet accumulation results. |
Sampler.SampleResult |
getSampleSet(ScoredDocIDs docids)
Compute a sample set out of the input set, based on the SamplingParams.getSampleRatio()
in effect. |
SamplingParams |
getSamplingParams()
Return the sampling params in effect |
FacetSearchParams |
overSampledSearchParams(FacetSearchParams original)
Over-sampled search params, wrapping each request with an over-sampled one. |
boolean |
shouldSample(ScoredDocIDs docIds)
Check if this sampler would complement for the input docIds |
FacetResult |
trimResult(FacetResult facetResult)
Trim the input facet result. Note: It is only valid to call this method with result obtained for a facet request created through overSampledSearchParams(FacetSearchParams) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Sampler()
SamplingParams
public Sampler(SamplingParams params) throws IllegalArgumentException
SamplingParams
params
- sampling params in effect
IllegalArgumentException
- if the provided SamplingParams are not validMethod Detail |
---|
public boolean shouldSample(ScoredDocIDs docIds)
public Sampler.SampleResult getSampleSet(ScoredDocIDs docids) throws IOException
SamplingParams.getSampleRatio()
in effect. Sub classes can override to alter how the sample set is
computed.
If the input set is of size smaller than SamplingParams.getMinSampleSize()
,
the input set is returned (no sampling takes place).
Other than that, the returned set size will not be larger than SamplingParams.getMaxSampleSize()
nor smaller than SamplingParams.getMinSampleSize()
.
docids
- full set of matching documents out of which a sample is needed.
IOException
public SampleFixer getSampleFixer(org.apache.lucene.index.IndexReader indexReader, TaxonomyReader taxonomyReader, FacetSearchParams searchParams)
TakmiSampleFixer
which is adequate only for
counting. For any other accumulator, provide a different fixer.
public final SamplingParams getSamplingParams()
public FacetResult trimResult(FacetResult facetResult) throws IllegalArgumentException
overSampledSearchParams(FacetSearchParams)
.
IllegalArgumentException
- if called with results not obtained for requests created
through overSampledSearchParams(FacetSearchParams)
public FacetSearchParams overSampledSearchParams(FacetSearchParams original)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |