public class SamplingWrapper extends FacetsAccumulator
Note: Sampling accumulation (Accumulation over a sampled-set of the results),
does not guarantee accurate values for
FacetResult.getNumValidDescendants()
&
FacetResultNode.getResidue()
.
DEFAULT_COMPLEMENT_THRESHOLD, DISABLE_COMPLEMENT, FORCE_COMPLEMENT, indexReader, searchParams, taxonomyReader
Constructor and Description |
---|
SamplingWrapper(FacetsAccumulator delegee,
Sampler sampler) |
Modifier and Type | Method and Description |
---|---|
List<FacetResult> |
accumulate(ScoredDocIDs docids)
Accumulate facets over given documents, according to facet requests in effect.
|
double |
getComplementThreshold() |
protected boolean |
isAllowLabeling()
Check if labeling is allowed for this accumulator.
|
protected void |
setAllowLabeling(boolean allowLabeling)
Set whether labeling is allowed for this accumulator.
|
void |
setComplementThreshold(double complementThreshold)
Set the complement threshold.
|
mayComplement
public SamplingWrapper(FacetsAccumulator delegee, Sampler sampler)
public List<FacetResult> accumulate(ScoredDocIDs docids) throws IOException
FacetsAccumulator
accumulate
in class FacetsAccumulator
docids
- documents (and their scores) for which facets are Accumulated.IOException
- on error.public double getComplementThreshold()
getComplementThreshold
in class FacetsAccumulator
FacetsAccumulator.getComplementThreshold()
public void setComplementThreshold(double complementThreshold)
FacetsAccumulator
Note that this optimization is only available when searching an index
whose IndexReader
implements both
IndexReader.directory()
and IndexReader.getVersion()
otherwise the optimization is silently disabled regardless of
the complement threshold settings.
For the default settings see FacetsAccumulator.DEFAULT_COMPLEMENT_THRESHOLD
.
To forcing complements in all cases pass FacetsAccumulator.FORCE_COMPLEMENT
.
This is mostly useful for testing purposes, as forcing complements when only
tiny fraction of available documents match the query does not make sense and
would incur performance degradations.
To disable complements pass FacetsAccumulator.DISABLE_COMPLEMENT
.
setComplementThreshold
in class FacetsAccumulator
complementThreshold
- FacetsAccumulator.setComplementThreshold(double)
protected boolean isAllowLabeling()
FacetsAccumulator
By default labeling is allowed. This allows one accumulator to invoke other accumulators for accumulation but keep to itself the responsibility of labeling. This might br handy since labeling is a costly operation.
isAllowLabeling
in class FacetsAccumulator
FacetsAccumulator.setAllowLabeling(boolean)
protected void setAllowLabeling(boolean allowLabeling)
FacetsAccumulator
setAllowLabeling
in class FacetsAccumulator
allowLabeling
- new setting for allow labelingFacetsAccumulator.isAllowLabeling()