|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.facet.search.params.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.ResultMode
Result structure manner of applying request's limits such as getNumLabel() and
getNumResults() . |
static class |
FacetRequest.SortBy
Sort options for facet results. |
static class |
FacetRequest.SortOrder
Requested sort order for the results. |
Field Summary | |
---|---|
static int |
DEFAULT_DEPTH
Default depth for facets accumulation. |
static FacetRequest.ResultMode |
DEFAULT_RESULT_MODE
Default result mode |
static FacetRequest.SortBy |
DEFAULT_SORT_BY
Default sort mode. |
Constructor Summary | |
---|---|
FacetRequest(CategoryPath path,
int numResults)
Initialize the request with a given path, and a requested number of facets results. |
Method Summary | |
---|---|
Object |
clone()
|
abstract Aggregator |
createAggregator(boolean useComplements,
FacetArrays arrays,
IndexReader indexReader,
TaxonomyReader taxonomy)
Create an aggregator for this facet request. |
CategoryListIterator |
createCategoryListIterator(IndexReader reader,
TaxonomyReader taxo,
FacetSearchParams sParams,
int partition)
Create the category list iterator for the specified partition. |
FacetResultsHandler |
createFacetResultsHandler(TaxonomyReader taxonomyReader)
Creates a new FacetResultsHandler that matches the request logic
and current settings, such as depth ,
limits-mode , etc, as well as the passed in
TaxonomyReader . |
boolean |
equals(Object o)
|
CategoryPath |
getCategoryPath()
The root category of this facet request. |
int |
getDepth()
How deeply to look under the given category. |
int |
getNumLabel()
If getNumLabel() |
int |
getNumResults()
The number of sub-categories to return (at most). |
FacetRequest.ResultMode |
getResultMode()
Return the requested result mode. |
FacetRequest.SortBy |
getSortBy()
Specify how should results be sorted. |
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()
|
abstract boolean |
requireDocumentScore()
Indicates whether the results of this request depends on each result document's score |
void |
setDepth(int depth)
|
void |
setNumLabel(int numLabel)
|
void |
setResultMode(FacetRequest.ResultMode resultMode)
|
void |
setSortBy(FacetRequest.SortBy sortBy)
|
void |
setSortOrder(FacetRequest.SortOrder sortOrder)
|
boolean |
supportsComplements()
Indicates whether this facet request is eligible for applying the complements optimization. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_DEPTH
getDepth()
,
Constant Field Valuespublic static final FacetRequest.SortBy DEFAULT_SORT_BY
getSortBy()
public static final FacetRequest.ResultMode DEFAULT_RESULT_MODE
getResultMode()
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 Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void setNumLabel(int numLabel)
public void setDepth(int depth)
public void setSortOrder(FacetRequest.SortOrder sortOrder)
public void setSortBy(FacetRequest.SortBy sortBy)
public final CategoryPath getCategoryPath()
NOTE: you should not modify the returned CategoryPath
, or
otherwise some methonds may not work properly, e.g. hashCode()
.
public final int getDepth()
public final int getNumLabel()
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 int getNumResults()
If Integer.MAX_VALUE is specified, all sub-categories are returned.
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 computed.
In the per-node mode, if this limit is 3,
3 top children of the target category
would be returned,
as well as 3 top children of each of them, and so forth, until the depth defined
by getDepth()
.
getResultMode()
public final FacetRequest.SortBy getSortBy()
public final FacetRequest.SortOrder getSortOrder()
public String toString()
toString
in class Object
public FacetResultsHandler createFacetResultsHandler(TaxonomyReader taxonomyReader)
FacetResultsHandler
that matches the request logic
and current settings, such as depth
,
limits-mode
, etc, as well as the passed in
TaxonomyReader
.
taxonomyReader
- taxonomy reader is needed e.g. for knowing the
taxonomy size.public final FacetRequest.ResultMode getResultMode()
public void setResultMode(FacetRequest.ResultMode resultMode)
resultMode
- the resultMode to setgetResultMode()
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public abstract Aggregator createAggregator(boolean useComplements, FacetArrays arrays, IndexReader indexReader, 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.indexReader
- index reader in effect.taxonomy
- reader of taxonomy in effect.
IOException
public CategoryListIterator createCategoryListIterator(IndexReader reader, TaxonomyReader taxo, FacetSearchParams sParams, int partition) throws IOException
IOException
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 boolean supportsComplements()
public abstract boolean requireDocumentScore()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |