|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.facet.search.FacetRequest
public abstract class FacetRequest
Request to accumulate facet information for a specified facet and possibly also some of its descendants, upto a specified depth.
The facet request additionally defines what information should be computed within the facet results, if and how should results be ordered, etc.
An example facet request is to look at all sub-categories of "Author", and return the 10 with the highest counts (sorted by decreasing count).
Nested Class Summary | |
---|---|
static class |
FacetRequest.FacetArraysSource
Specifies which array of FacetArrays should be used to resolve
values. |
static class |
FacetRequest.ResultMode
Result structure manner of applying request's limits such as getNumLabel() and numResults . |
static class |
FacetRequest.SortOrder
Requested sort order for the results. |
Field Summary | |
---|---|
CategoryPath |
categoryPath
|
static int |
DEFAULT_DEPTH
Default depth for facets accumulation. |
static FacetRequest.ResultMode |
DEFAULT_RESULT_MODE
Default result mode |
int |
numResults
|
Constructor Summary | |
---|---|
FacetRequest(CategoryPath path,
int numResults)
Initialize the request with a given path, and a requested number of facets results. |
Method Summary | |
---|---|
Aggregator |
createAggregator(boolean useComplements,
FacetArrays arrays,
TaxonomyReader taxonomy)
Create an aggregator for this facet request. |
boolean |
equals(Object o)
|
int |
getDepth()
How deeply to look under the given category. |
abstract FacetRequest.FacetArraysSource |
getFacetArraysSource()
Returns the FacetRequest.FacetArraysSource this FacetRequest uses in
getValueOf(FacetArrays, int) . |
int |
getNumLabel()
If getNumLabel() < getNumResults(), only the first getNumLabel() results will have their category paths calculated, and the rest will only be available as ordinals (category numbers) and will have null paths. |
FacetRequest.ResultMode |
getResultMode()
Return the requested result mode. |
FacetRequest.SortOrder |
getSortOrder()
Return the requested order of results. |
abstract double |
getValueOf(FacetArrays arrays,
int idx)
Return the value of a category used for facets computations for this request. |
int |
hashCode()
|
void |
setDepth(int depth)
|
void |
setNumLabel(int numLabel)
|
void |
setResultMode(FacetRequest.ResultMode resultMode)
|
void |
setSortOrder(FacetRequest.SortOrder sortOrder)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_DEPTH
getDepth()
,
Constant Field Valuespublic static final FacetRequest.ResultMode DEFAULT_RESULT_MODE
getResultMode()
public final CategoryPath categoryPath
public final int numResults
Constructor Detail |
---|
public FacetRequest(CategoryPath path, int numResults)
setNumLabel(int)
.
NOTE: if numResults
is given as
Integer.MAX_VALUE
than all the facet results would be
returned, without any limit.
NOTE: it is assumed that the given CategoryPath
is not
modified after construction of this object. Otherwise, some things may not
function properly, e.g. hashCode()
.
IllegalArgumentException
- if numResults is ≤ 0Method Detail |
---|
public Aggregator createAggregator(boolean useComplements, FacetArrays arrays, TaxonomyReader taxonomy) throws IOException
useComplements
- whether the complements optimization is being used for current
computation.arrays
- provider for facet arrays in use for current computation.taxonomy
- reader of taxonomy in effect.
IOException
- If there is a low-level I/O error.public boolean equals(Object o)
equals
in class Object
public final int getDepth()
public abstract FacetRequest.FacetArraysSource getFacetArraysSource()
FacetRequest.FacetArraysSource
this FacetRequest
uses in
getValueOf(FacetArrays, int)
.
public final int getNumLabel()
If Integer.MAX_VALUE is specified, all results are labled.
The purpose of this parameter is to avoid having to run the whole faceted search again when the user asks for more values for the facet; The application can ask (getNumResults()) for more values than it needs to show, but keep getNumLabel() only the number it wants to immediately show. The slow-down caused by finding more values is negligible, because the slowest part - finding the categories' paths, is avoided.
Depending on the LimitsMode
, this limit is applied
globally or per results node. In the global mode, if this limit is 3, only
3 top results would be labeled. In the per-node mode, if this limit is 3, 3
top children of the target category
would be labeled,
as well as 3 top children of each of them, and so forth, until the depth
defined by getDepth()
.
getResultMode()
public final FacetRequest.ResultMode getResultMode()
public final FacetRequest.SortOrder getSortOrder()
public abstract double getValueOf(FacetArrays arrays, int idx)
arrays
- provider for facet arrays in use for current computation.idx
- an index into the count arrays now in effect in
arrays
. E.g., for ordinal number n, with
partition, of size partitionSize, now covering n,
getValueOf
would be invoked with idx
being n % partitionSize.public int hashCode()
hashCode
in class Object
public void setDepth(int depth)
public void setNumLabel(int numLabel)
public void setResultMode(FacetRequest.ResultMode resultMode)
resultMode
- the resultMode to setgetResultMode()
public void setSortOrder(FacetRequest.SortOrder sortOrder)
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |