org.apache.lucene.facet.sampling

## Class SamplingAccumulator

- java.lang.Object
- - org.apache.lucene.facet.search.FacetsAccumulator
  - - org.apache.lucene.facet.search.StandardFacetsAccumulator
    - - org.apache.lucene.facet.sampling.SamplingAccumulator

-     public class SamplingAccumulator
      extends StandardFacetsAccumulator

  Facets accumulation with sampling.

  Note two major differences between this class and `SamplingWrapper`:

  1. Latter can wrap any other `FacetsAccumulator` while this class directly extends `StandardFacetsAccumulator`.
  2. This class can effectively apply sampling on the complement set of matching document, thereby working efficiently with the complement optimization - see `StandardFacetsAccumulator.getComplementThreshold()` .

  Note: Sampling accumulation (Accumulation over a sampled-set of the results), does not guarantee accurate values for `FacetResult.getNumValidDescendants()`.

  See Also:
    `Sampler`
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.facet.search.StandardFacetsAccumulator

      `DEFAULT_COMPLEMENT_THRESHOLD, DISABLE_COMPLEMENT, FORCE_COMPLEMENT, isUsingComplements, maxPartitions, partitionSize`

    - ### Fields inherited from class org.apache.lucene.facet.search.FacetsAccumulator

      `facetArrays, indexReader, searchParams, taxonomyReader`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SamplingAccumulator(Sampler sampler, FacetSearchParams searchParams, IndexReader indexReader, TaxonomyReader taxonomyReader)` Constructor...
    `SamplingAccumulator(Sampler sampler, FacetSearchParams searchParams, IndexReader indexReader, TaxonomyReader taxonomyReader, FacetArrays facetArrays)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<FacetResult>` | `accumulate(ScoredDocIDs docids)`
    `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

      `accumulate, createFacetResultsHandler, getCategoryListMap, getComplementThreshold, isUsingComplements, mayComplement, setComplementThreshold, shouldComplement`

    - ### Methods inherited from class org.apache.lucene.facet.search.FacetsAccumulator

      `create, getAggregator, getCategoryLists`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SamplingAccumulator

          public SamplingAccumulator(Sampler sampler,
                             FacetSearchParams searchParams,
                             IndexReader indexReader,
                             TaxonomyReader taxonomyReader,
                             FacetArrays facetArrays)

    - #### SamplingAccumulator

          public SamplingAccumulator(Sampler sampler,
                             FacetSearchParams searchParams,
                             IndexReader indexReader,
                             TaxonomyReader taxonomyReader)

      Constructor...

  - ### Method Detail

    - #### accumulate

          public List<FacetResult> accumulate(ScoredDocIDs docids)
                                       throws IOException

      Overrides:
        `accumulate` in class `StandardFacetsAccumulator`
      Throws:
        `IOException`

    - #### 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 class `StandardFacetsAccumulator`
      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 class `StandardFacetsAccumulator`
      Returns:
        a factor by which total counts should be multiplied

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.