Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.facet.search
Class FacetsAccumulator

    java.lang.Object
      org.apache.lucene.facet.search.FacetsAccumulator

Direct Known Subclasses:
  SamplingWrapper, StandardFacetsAccumulator

    public abstract class FacetsAccumulator

extends Object

Driver for Accumulating facets of faceted search requests over given documents.

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

Field Summary
`static double` | `DEFAULT_COMPLEMENT_THRESHOLD` Default threshold for using the complements optimization.
`static double` | `DISABLE_COMPLEMENT` Passing this to `setComplementThreshold(double)` will disable using complement optimization.
`static double` | `FORCE_COMPLEMENT` Passing this to `setComplementThreshold(double)` will force using complement optimization.
`protected org.apache.lucene.index.IndexReader` | `indexReader`
`protected FacetSearchParams` | `searchParams`
`protected TaxonomyReader` | `taxonomyReader`

Constructor Summary
`FacetsAccumulator(FacetSearchParams searchParams, org.apache.lucene.index.IndexReader indexReader, TaxonomyReader taxonomyReader)`

Method Summary
`abstract 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 boolean` | `mayComplement()` check if all requests are complementable
`protected void` | `setAllowLabeling(boolean allowLabeling)` Set whether labeling is allowed for this accumulator.
`void` | `setComplementThreshold(double complementThreshold)` Set the complement threshold.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_COMPLEMENT_THRESHOLD

    public static final double DEFAULT_COMPLEMENT_THRESHOLD

  Default threshold for using the complements optimization. If accumulating facets for a document set larger than this ratio of the index size than perform the complement optimization.

  See Also:
    `for more info on the complements optimization.`, Constant Field Values

### DISABLE_COMPLEMENT

    public static final double DISABLE_COMPLEMENT

  Passing this to `setComplementThreshold(double)` will disable using complement optimization.

  See Also:
    Constant Field Values

### FORCE_COMPLEMENT

    public static final double FORCE_COMPLEMENT

  Passing this to `setComplementThreshold(double)` will force using complement optimization.

  See Also:
    Constant Field Values

### taxonomyReader

    protected final TaxonomyReader taxonomyReader

### indexReader

    protected final org.apache.lucene.index.IndexReader indexReader

### searchParams

    protected FacetSearchParams searchParams

Constructor Detail

### FacetsAccumulator

    public FacetsAccumulator(FacetSearchParams searchParams,
                             org.apache.lucene.index.IndexReader indexReader,
                             TaxonomyReader taxonomyReader)

Method Detail

### accumulate

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

  Accumulate facets over given documents, according to facet requests in effect.

  Parameters:
    `docids` - documents (and their scores) for which facets are Accumulated.
  Returns:
    Accumulated facets.
  Throws:
    `IOException` - on error.

### getComplementThreshold

    public double getComplementThreshold()

  Returns:
    the complement threshold
  See Also:
    `setComplementThreshold(double)`

### setComplementThreshold

    public void setComplementThreshold(double complementThreshold)

  Set the complement threshold. This threshold will dictate whether the complements optimization is applied. The optimization is to count for less documents. It is useful when the same FacetSearchParams are used for varying sets of documents. The first time complements is used the "total counts" are computed - counting for all the documents in the collection. Then, only the complementing set of documents is considered, and used to decrement from the overall counts, thereby walking through less documents, which is faster.

  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 `DEFAULT_COMPLEMENT_THRESHOLD`.

  To forcing complements in all cases pass `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 `DISABLE_COMPLEMENT`.

  Parameters:
    `complementThreshold` - the complement threshold to set

### isAllowLabeling

    protected boolean isAllowLabeling()

  Check if labeling is allowed for this accumulator.

  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.

  Returns:
    true of labeling is allowed for this accumulator
  See Also:
    `setAllowLabeling(boolean)`

### setAllowLabeling

    protected void setAllowLabeling(boolean allowLabeling)

  Set whether labeling is allowed for this accumulator.

  Parameters:
    `allowLabeling` - new setting for allow labeling
  See Also:
    `isAllowLabeling()`

### mayComplement

    protected boolean mayComplement()

  check if all requests are complementable

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD