public abstract class FacetsAccumulator extends Object
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 IndexReader |
indexReader |
protected FacetSearchParams |
searchParams |
protected TaxonomyReader |
taxonomyReader |
Constructor and Description |
---|
FacetsAccumulator(FacetSearchParams searchParams,
IndexReader indexReader,
TaxonomyReader taxonomyReader) |
Modifier and Type | Method and Description |
---|---|
abstract List<FacetResult> |
accumulate(ScoredDocIDs docids)
Accumulate facets over given documents, according to facet requests in effect.
|
double |
getComplementThreshold() |
protected boolean |
isAllowLabeling()
Check if labeling is allowed for this accumulator.
|
protected boolean |
mayComplement()
check if all requests are complementable
|
protected void |
setAllowLabeling(boolean allowLabeling)
Set whether labeling is allowed for this accumulator.
|
void |
setComplementThreshold(double complementThreshold)
Set the complement threshold.
|
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 final TaxonomyReader taxonomyReader
protected final IndexReader indexReader
protected FacetSearchParams searchParams
public FacetsAccumulator(FacetSearchParams searchParams, IndexReader indexReader, TaxonomyReader taxonomyReader)
public abstract List<FacetResult> accumulate(ScoredDocIDs docids) throws IOException
docids
- documents (and their scores) for which facets are Accumulated.IOException
- on error.public double getComplementThreshold()
setComplementThreshold(double)
public void setComplementThreshold(double complementThreshold)
Note that this optimization is only available when searching an index
whose IndexReader
implements both
IndexReader.directory()
and IndexReader.getVersion()
otherwise the optimization is silently disabled regardless of
the complement threshold settings.
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 setprotected boolean isAllowLabeling()
By default labeling is allowed. This allows one accumulator to invoke other accumulators for accumulation but keep to itself the responsibility of labeling. This might br handy since labeling is a costly operation.
setAllowLabeling(boolean)
protected void setAllowLabeling(boolean allowLabeling)
allowLabeling
- new setting for allow labelingisAllowLabeling()
protected boolean mayComplement()