org.apache.lucene.facet.search

## Class SumScoreFacetRequest

- java.lang.Object
- - org.apache.lucene.facet.search.FacetRequest
  - - org.apache.lucene.facet.search.SumScoreFacetRequest

    public class SumScoreFacetRequest
    extends FacetRequest

A `FacetRequest` for weighting facets by summing the scores of matching documents.

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

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.lucene.facet.search.FacetRequest

`FacetRequest.FacetArraysSource, FacetRequest.ResultMode, FacetRequest.SortOrder`

### Field Summary

### Fields inherited from class org.apache.lucene.facet.search.FacetRequest

`categoryPath, DEFAULT_DEPTH, DEFAULT_RESULT_MODE, numResults`

### Constructor Summary

Constructors
Constructor and Description
`SumScoreFacetRequest(CategoryPath path, int num)` Create a score facet request for a given node in the taxonomy.

### Method Summary

Methods
`Aggregator` `createAggregator(boolean useComplements, FacetArrays arrays, TaxonomyReader taxonomy)` Create an aggregator for this facet request.
`FacetRequest.FacetArraysSource` `getFacetArraysSource()` Returns the `FacetRequest.FacetArraysSource` this `FacetRequest` uses in `FacetRequest.getValueOf(FacetArrays, int)`.
`double` `getValueOf(FacetArrays arrays, int ordinal)` Return the value of a category used for facets computations for this request.

### Methods inherited from class org.apache.lucene.facet.search.FacetRequest

`equals, getDepth, getNumLabel, getResultMode, getSortOrder, hashCode, setDepth, setNumLabel, setResultMode, setSortOrder, toString`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SumScoreFacetRequest

    public SumScoreFacetRequest(CategoryPath path,
                        int num)

Create a score facet request for a given node in the taxonomy.

### Method Detail

#### createAggregator

    public Aggregator createAggregator(boolean useComplements,
                              FacetArrays arrays,
                              TaxonomyReader taxonomy)

Description copied from class: `FacetRequest`
Create an aggregator for this facet request. Aggregator action depends on request definition. For a count request, it will usually increment the count for that facet.

Overrides:
  `createAggregator` in class `FacetRequest`
Parameters:
  `useComplements` - whether the complements optimization is being used for current computation.
  `arrays` - provider for facet arrays in use for current computation.
  `taxonomy` - reader of taxonomy in effect.

#### getValueOf

    public double getValueOf(FacetArrays arrays,
                    int ordinal)

Description copied from class: `FacetRequest`
Return the value of a category used for facets computations for this request. For a count request this would be the count for that facet, i.e. an integer number. but for other requests this can be the result of a more complex operation, and the result can be any double precision number. Having this method with a general name value which is double precision allows to have more compact API and code for handling counts and perhaps other requests (such as for associations) very similarly, and by the same code and API, avoiding code duplication.

Specified by:
  `getValueOf` in class `FacetRequest`
Parameters:
  `arrays` - provider for facet arrays in use for current computation.
  `ordinal` - an index into the count arrays now in effect in `arrays`. E.g., for ordinal number n, with partition, of size partitionSize, now covering n, `getValueOf` would be invoked with `idx` being n % partitionSize.

#### getFacetArraysSource

    public FacetRequest.FacetArraysSource getFacetArraysSource()

Description copied from class: `FacetRequest`
Returns the `FacetRequest.FacetArraysSource` this `FacetRequest` uses in `FacetRequest.getValueOf(FacetArrays, int)`.

Specified by:
  `getFacetArraysSource` in class `FacetRequest`