public abstract class FacetRequest extends Object
number of child categories
to return as well as
which
categories to consider the "top" (highest or
lowest ranking ones).
If the category being aggregated is hierarchical, you can also specify the
depth
up which to aggregate child categories as well
as how the result should be constructed
.
Modifier and Type | Class and Description |
---|---|
static class |
FacetRequest.ResultMode
When
getDepth() is greater than 1, defines the
structure of the result as well as how constraints such as
numResults and getNumLabel() are
applied. |
static class |
FacetRequest.SortOrder
Defines which categories to return.
|
Modifier and Type | Field and Description |
---|---|
CategoryPath |
categoryPath
The category being aggregated in this facet request.
|
int |
numResults
The number of child categories to return for
categoryPath . |
Constructor and Description |
---|
FacetRequest(CategoryPath path,
int numResults)
Constructor with the given category to aggregate and the number of child
categories to return.
|
Modifier and Type | Method and Description |
---|---|
abstract FacetsAggregator |
createFacetsAggregator(FacetIndexingParams fip)
Returns the
FacetsAggregator which can aggregate the categories of
this facet request. |
boolean |
equals(Object o) |
int |
getDepth()
How deeply to look under
categoryPath . |
int |
getNumLabel()
Allows to specify the number of categories to label.
|
FacetRequest.ResultMode |
getResultMode()
Return the requested result mode (defaults to
FacetRequest.ResultMode.PER_NODE_IN_TREE . |
FacetRequest.SortOrder |
getSortOrder()
Return the requested order of results (defaults to
FacetRequest.SortOrder.DESCENDING . |
int |
hashCode() |
void |
setDepth(int depth)
Sets the depth up to which to aggregate facets.
|
void |
setNumLabel(int numLabel)
Sets the number of categories to label.
|
void |
setResultMode(FacetRequest.ResultMode resultMode)
Sets the
FacetRequest.ResultMode for this request. |
void |
setSortOrder(FacetRequest.SortOrder sortOrder)
Sets the
FacetRequest.SortOrder for this request. |
String |
toString() |
public final CategoryPath categoryPath
public final int numResults
categoryPath
.public FacetRequest(CategoryPath path, int numResults)
path
- the category to aggregate. Cannot be null
.numResults
- the number of child categories to return. If set to
Integer.MAX_VALUE
, all immediate child categories will be
returned. Must be greater than 0.public abstract FacetsAggregator createFacetsAggregator(FacetIndexingParams fip)
FacetsAggregator
which can aggregate the categories of
this facet request. The aggregator is expected to aggregate category values
into FacetArrays
. If the facet request does not support that, e.g.
RangeFacetRequest
, it can return null
. Note though that
such requests require a dedicated FacetsAccumulator
.public final int getDepth()
categoryPath
. By default, only its
immediate children are aggregated (depth=1). If set to
Integer.MAX_VALUE
, the entire sub-tree of the category will be
aggregated.
NOTE: setting depth to 0 means that only the category itself should
be aggregated. In that case, make sure to index the category with
CategoryListParams.OrdinalPolicy.ALL_PARENTS
, unless it is not the root category (the
dimension), in which case CategoryListParams.OrdinalPolicy.ALL_BUT_DIMENSION
is fine
too.
public final int getNumLabel()
This allows an app to request a large number of results to return, while labeling them on-demand (e.g. when the UI requests to show more categories).
public final FacetRequest.ResultMode getResultMode()
FacetRequest.ResultMode.PER_NODE_IN_TREE
.public final FacetRequest.SortOrder getSortOrder()
FacetRequest.SortOrder.DESCENDING
.public void setDepth(int depth)
getDepth()
public void setNumLabel(int numLabel)
getNumLabel()
public void setResultMode(FacetRequest.ResultMode resultMode)
FacetRequest.ResultMode
for this request.getResultMode()
public void setSortOrder(FacetRequest.SortOrder sortOrder)
FacetRequest.SortOrder
for this request.getSortOrder()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.