Class SamplingAccumulator
- java.lang.Object
-
- org.apache.lucene.facet.search.FacetsAccumulator
-
- org.apache.lucene.facet.search.StandardFacetsAccumulator
-
- org.apache.lucene.facet.search.sampling.SamplingAccumulator
-
public class SamplingAccumulator extends StandardFacetsAccumulator
Facets accumulation with sampling.
Note two major differences between this class and
SamplingWrapper
:- Latter can wrap any other
FacetsAccumulator
while this class directly extendsStandardFacetsAccumulator
. - This class can effectively apply sampling on the complement set of
matching document, thereby working efficiently with the complement
optimization - see
FacetsAccumulator.getComplementThreshold()
.
Note: Sampling accumulation (Accumulation over a sampled-set of the results), does not guarantee accurate values for
FacetResult.getNumValidDescendants()
&FacetResultNode.getResidue()
.- See Also:
Sampler
- WARNING: This API is experimental and might change in incompatible ways in the next release.
- Latter can wrap any other
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.facet.search.StandardFacetsAccumulator
floatArrayAllocator, intArrayAllocator, isUsingComplements, maxPartitions, partitionSize
-
Fields inherited from class org.apache.lucene.facet.search.FacetsAccumulator
DEFAULT_COMPLEMENT_THRESHOLD, DISABLE_COMPLEMENT, FORCE_COMPLEMENT, indexReader, searchParams, taxonomyReader
-
-
Constructor Summary
Constructors Constructor Description SamplingAccumulator(Sampler sampler, FacetSearchParams searchParams, org.apache.lucene.index.IndexReader indexReader, TaxonomyReader taxonomyReader)
Constructor...SamplingAccumulator(Sampler sampler, FacetSearchParams searchParams, org.apache.lucene.index.IndexReader indexReader, TaxonomyReader taxonomyReader, IntArrayAllocator intArrayAllocator, FloatArrayAllocator floatArrayAllocator)
Constructor...
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<FacetResult>
accumulate(ScoredDocIDs docids)
Accumulate facets over given documents, according to facet requests in effect.protected ScoredDocIDs
actualDocsToAccumulate(ScoredDocIDs docids)
Set the actual set of documents over which accumulation should take place.protected double
getTotalCountsFactor()
Expert: factor by which counts should be multiplied when initializing the count arrays from total counts.-
Methods inherited from class org.apache.lucene.facet.search.StandardFacetsAccumulator
getCategoryListMap, shouldComplement
-
Methods inherited from class org.apache.lucene.facet.search.FacetsAccumulator
getComplementThreshold, isAllowLabeling, mayComplement, setAllowLabeling, setComplementThreshold
-
-
-
-
Constructor Detail
-
SamplingAccumulator
public SamplingAccumulator(Sampler sampler, FacetSearchParams searchParams, org.apache.lucene.index.IndexReader indexReader, TaxonomyReader taxonomyReader, IntArrayAllocator intArrayAllocator, FloatArrayAllocator floatArrayAllocator)
Constructor...
-
SamplingAccumulator
public SamplingAccumulator(Sampler sampler, FacetSearchParams searchParams, org.apache.lucene.index.IndexReader indexReader, TaxonomyReader taxonomyReader)
Constructor...
-
-
Method Detail
-
accumulate
public List<FacetResult> accumulate(ScoredDocIDs docids) throws IOException
Description copied from class:FacetsAccumulator
Accumulate facets over given documents, according to facet requests in effect.- Overrides:
accumulate
in classStandardFacetsAccumulator
- Parameters:
docids
- documents (and their scores) for which facets are Accumulated.- Returns:
- Accumulated facets.
- Throws:
IOException
- on error.
-
actualDocsToAccumulate
protected ScoredDocIDs actualDocsToAccumulate(ScoredDocIDs docids) throws IOException
Description copied from class:StandardFacetsAccumulator
Set the actual set of documents over which accumulation should take place.Allows to override the set of documents to accumulate for. Invoked just before actual accumulating starts. From this point that set of documents remains unmodified. Default implementation just returns the input unchanged.
- Overrides:
actualDocsToAccumulate
in classStandardFacetsAccumulator
- Parameters:
docids
- candidate documents to accumulate for- Returns:
- actual documents to accumulate for
- Throws:
IOException
-
getTotalCountsFactor
protected double getTotalCountsFactor()
Description copied from class:StandardFacetsAccumulator
Expert: factor by which counts should be multiplied when initializing the count arrays from total counts. Default implementation for this returns 1, which is a no op.- Overrides:
getTotalCountsFactor
in classStandardFacetsAccumulator
- Returns:
- a factor by which total counts should be multiplied
-
-