org.apache.lucene.facet.partitions
public abstract class PartitionsFacetResultsHandler extends FacetResultsHandler
FacetResultsHandler designed to work with facet partitions.facetArrays, facetRequest, resolver, taxonomyReader| Constructor and Description |
|---|
PartitionsFacetResultsHandler(TaxonomyReader taxonomyReader,
FacetRequest facetRequest,
OrdinalValueResolver resolver,
FacetArrays facetArrays) |
| Modifier and Type | Method and Description |
|---|---|
FacetResult |
compute()
Computes the
FacetResult for the given FacetArrays. |
abstract IntermediateFacetResult |
fetchPartitionResult(int offset)
Fetch results of a single partition, given facet arrays for that partition,
and based on the matching documents and faceted search parameters.
|
protected boolean |
isSelfPartition(int ordinal,
FacetArrays facetArrays,
int offset)
Check if an array contains the partition which contains ordinal
|
abstract void |
labelResult(FacetResult facetResult)
Label results according to settings in
FacetRequest, such as
FacetRequest.getNumLabel(). |
abstract IntermediateFacetResult |
mergeResults(IntermediateFacetResult... tmpResults)
Merge results of several facet partitions.
|
abstract FacetResult |
rearrangeFacetResult(FacetResult facetResult)
Perform any rearrangement as required on a facet result that has changed after
it was rendered.
|
abstract FacetResult |
renderFacetResult(IntermediateFacetResult tmpResult)
Create a facet result from the temporary result.
|
public PartitionsFacetResultsHandler(TaxonomyReader taxonomyReader, FacetRequest facetRequest, OrdinalValueResolver resolver, FacetArrays facetArrays)
public abstract IntermediateFacetResult fetchPartitionResult(int offset) throws IOException
offset - offset in input arrays where partition startsfacetRequest, requests an
illegal FacetResult, like, e.g., a root node category path that
does not exist in constructor parameter taxonomyReader
.IOException - on errorpublic abstract IntermediateFacetResult mergeResults(IntermediateFacetResult... tmpResults) throws IOException
IntermediateFacetResult must be ones
that were created by this handler otherwise a ClassCastException is
thrown. In addition, all passed IntermediateFacetResult must have
the same FacetRequest otherwise an IllegalArgumentException
is thrown.tmpResults - one or more temporary results created by this
handler.IOException - on error.ClassCastException - if the temporary result passed was not created
by this handlerIllegalArgumentException - if passed facetResults do not
have the same FacetRequestIntermediateFacetResult.getFacetRequest()public abstract FacetResult renderFacetResult(IntermediateFacetResult tmpResult) throws IOException
tmpResult - temporary result to be rendered as a FacetResultIOException - on error.public abstract FacetResult rearrangeFacetResult(FacetResult facetResult)
Possible use case: a sampling facets accumulator invoked another other facets accumulator on a sample set of documents, obtained rendered facet results, fixed their counts, and now it is needed to sort the results differently according to the fixed counts.
facetResult - result to be rearranged.FacetResultNode.valuepublic abstract void labelResult(FacetResult facetResult) throws IOException
FacetRequest, such as
FacetRequest.getNumLabel(). Usually invoked by
OldFacetsAccumulator.accumulate(ScoredDocIDs)facetResult - facet result to be labeled.IOException - on errorprotected boolean isSelfPartition(int ordinal,
FacetArrays facetArrays,
int offset)
ordinal - checked facetfacetArrays - facet arrays for the certain partitionoffset - offset in input arrays where partition startspublic final FacetResult compute() throws IOException
FacetResultsHandlerFacetResult for the given FacetArrays.compute in class FacetResultsHandlerIOExceptionCopyright © 2000-2014 Apache Software Foundation. All Rights Reserved.