public class OldFacetsAccumulator extends TaxonomyFacetsAccumulator
FacetsAccumulator
which supports partitions, sampling and
complement counting.
NOTE: this accumulator still uses the old API and will be removed
eventually in favor of dedicated accumulators which support the above
features ovee the new FacetsAggregator
API. It provides
Aggregator
implementations for CountFacetRequest
,
SumScoreFacetRequest
and Sampler.OverSampledFacetRequest
. If you need
to use it in conjunction with other facet requests, you should override
createAggregator(FacetRequest, FacetArrays)
.
Modifier and Type | Field and Description |
---|---|
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 boolean |
isUsingComplements |
protected int |
maxPartitions |
protected int |
partitionSize |
facetArrays, indexReader, taxonomyReader
searchParams
Constructor and Description |
---|
OldFacetsAccumulator(FacetSearchParams searchParams,
IndexReader indexReader,
TaxonomyReader taxonomyReader) |
OldFacetsAccumulator(FacetSearchParams searchParams,
IndexReader indexReader,
TaxonomyReader taxonomyReader,
FacetArrays facetArrays) |
Modifier and Type | Method and Description |
---|---|
List<FacetResult> |
accumulate(List<FacetsCollector.MatchingDocs> matchingDocs)
Used by
FacetsCollector to build the list of facet results that match the facet requests that were
given in the constructor. |
List<FacetResult> |
accumulate(ScoredDocIDs docids) |
protected ScoredDocIDs |
actualDocsToAccumulate(ScoredDocIDs docids)
Set the actual set of documents over which accumulation should take place.
|
protected Aggregator |
createAggregator(FacetRequest fr,
FacetArrays facetArrays) |
PartitionsFacetResultsHandler |
createFacetResultsHandler(FacetRequest fr,
OrdinalValueResolver resolver)
|
OrdinalValueResolver |
createOrdinalValueResolver(FacetRequest fr)
Creates an
OrdinalValueResolver for the given FacetRequest . |
protected HashMap<CategoryListIterator,Aggregator> |
getCategoryListMap(FacetArrays facetArrays,
int partition)
|
double |
getComplementThreshold()
Returns the complement threshold.
|
protected double |
getTotalCountsFactor()
Expert: factor by which counts should be multiplied when initializing
the count arrays from total counts.
|
boolean |
isUsingComplements()
Returns true if complements are enabled.
|
protected boolean |
mayComplement()
check if all requests are complementable
|
void |
setComplementThreshold(double complementThreshold)
Set the complement threshold.
|
protected boolean |
shouldComplement(ScoredDocIDs docids)
Check if it is worth to use complements
|
getAggregator, groupRequests, requiresDocScores
create, create, emptyResult
public static final double DEFAULT_COMPLEMENT_THRESHOLD
public static final double DISABLE_COMPLEMENT
setComplementThreshold(double)
will disable using complement optimization.public static final double FORCE_COMPLEMENT
setComplementThreshold(double)
will force using complement optimization.protected int partitionSize
protected int maxPartitions
protected boolean isUsingComplements
public OldFacetsAccumulator(FacetSearchParams searchParams, IndexReader indexReader, TaxonomyReader taxonomyReader)
public OldFacetsAccumulator(FacetSearchParams searchParams, IndexReader indexReader, TaxonomyReader taxonomyReader, FacetArrays facetArrays)
public List<FacetResult> accumulate(ScoredDocIDs docids) throws IOException
IOException
protected boolean mayComplement()
public PartitionsFacetResultsHandler createFacetResultsHandler(FacetRequest fr, OrdinalValueResolver resolver)
TaxonomyFacetsAccumulator
createFacetResultsHandler
in class TaxonomyFacetsAccumulator
protected ScoredDocIDs actualDocsToAccumulate(ScoredDocIDs docids) throws IOException
Allows to override the set of documents to accumulate for. Invoked just before actual accumulating starts. From this point that set of documents remains unmodified. Default implementation just returns the input unchanged.
docids
- candidate documents to accumulate forIOException
protected boolean shouldComplement(ScoredDocIDs docids)
public OrdinalValueResolver createOrdinalValueResolver(FacetRequest fr)
OrdinalValueResolver
for the given FacetRequest
.
By default this method supports CountFacetRequest
and
SumScoreFacetRequest
. You should override if you are using other
requests with this accumulator.protected double getTotalCountsFactor()
protected Aggregator createAggregator(FacetRequest fr, FacetArrays facetArrays)
protected HashMap<CategoryListIterator,Aggregator> getCategoryListMap(FacetArrays facetArrays, int partition) throws IOException
Aggregator
and a CategoryListIterator
for each
and every FacetRequest
. Generating a map, matching each
categoryListIterator to its matching aggregator.
If two CategoryListIterators are served by the same aggregator, a single aggregator is returned for both. NOTE: If a given category list iterator is needed with two different aggregators (e.g counting and association) - an exception is thrown as this functionality is not supported at this time.
IOException
public List<FacetResult> accumulate(List<FacetsCollector.MatchingDocs> matchingDocs) throws IOException
TaxonomyFacetsAccumulator
FacetsCollector
to build the list of facet results
that match the facet requests
that were
given in the constructor.accumulate
in class TaxonomyFacetsAccumulator
matchingDocs
- the documents that matched the query, per-segment.IOException
public double getComplementThreshold()
setComplementThreshold(double)
public void setComplementThreshold(double complementThreshold)
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
.
complementThreshold
- the complement threshold to setgetComplementThreshold()
public boolean isUsingComplements()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.