public class TopKFacetResultsHandler extends FacetResultsHandler
K is global (among all results) and is defined by
Note: Values of 0 (Zero) are ignored by this results handler.
|Constructor and Description|
Construct top-K results handler.
|Modifier and Type||Method and Description|
Fetch results of a single partition, given facet arrays for that partition, and based on the matching documents and faceted search parameters.
Merge results of several facet partitions.
Perform any rearrangement as required on a facet result that has changed after it was rendered.
Create a facet result from the temporary result.
getFacetRequest, getTaxonomyReader, isSelfPartition
public IntermediateFacetResult fetchPartitionResult(FacetArrays facetArrays, int offset) throws IOException
facetArrays- facet arrays for the certain partition
offset- offset in input arrays where partition starts
facetRequest, requests an illegal FacetResult, like, e.g., a root node category path that does not exist in constructor parameter
IOException- on error
public IntermediateFacetResult mergeResults(IntermediateFacetResult... tmpResults) throws IOException
IntermediateFacetResultmust be ones that were created by this handler otherwise a
ClassCastExceptionis thrown. In addition, all passed
IntermediateFacetResultmust have the same
tmpResults- one or more temporary results created by this handler.
IOException- on error.
public FacetResult renderFacetResult(IntermediateFacetResult tmpResult)
public 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.
public void labelResult(FacetResult facetResult) throws IOException
FacetRequest, such as
FacetRequest.getNumLabel(). Usually invoked by