org.apache.lucene.facet.search.params
Class CountFacetRequest
java.lang.Object
org.apache.lucene.facet.search.params.FacetRequest
org.apache.lucene.facet.search.params.CountFacetRequest
- All Implemented Interfaces:
- Cloneable
public class CountFacetRequest
- extends FacetRequest
Facet request for counting facets.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
Methods inherited from class org.apache.lucene.facet.search.params.FacetRequest |
clone, createCategoryListIterator, createFacetResultsHandler, equals, getCategoryPath, getDepth, getNumLabel, getNumResults, getResultMode, getSortBy, getSortOrder, hashCode, setDepth, setNumLabel, setResultMode, setSortBy, setSortOrder, toString |
CountFacetRequest
public CountFacetRequest(CategoryPath path,
int num)
- Create a count facet request for a given node in the taxonomy.
- Parameters:
path
- category path of the category of interest.num
- number of child categories for which count info is requeted.
reqiested. Default implementation will find top categories, -
this behavior can be overridden by overriding
FacetRequest.createFacetResultsHandler(TaxonomyReader)
.
createAggregator
public Aggregator createAggregator(boolean useComplements,
FacetArrays arrays,
IndexReader reader,
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.
- Specified by:
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.reader
- index reader in effect.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.
supportsComplements
public boolean supportsComplements()
- Description copied from class:
FacetRequest
- Indicates whether this facet request is eligible for applying the complements optimization.
- Overrides:
supportsComplements
in class FacetRequest
requireDocumentScore
public boolean requireDocumentScore()
- Description copied from class:
FacetRequest
- Indicates whether the results of this request depends on each result document's score
- Specified by:
requireDocumentScore
in class FacetRequest