public abstract class TdbFacet extends java.lang.Object implements java.lang.Iterable<TdbFacetValue>
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears accumulated state from this object.
|
abstract void |
close()
Closes this facet by releasing server-side resources and removes the
the accumulated state from the object.
|
java.lang.String |
getBaselineKey()
Gets the key identifying the facet baseline to set or use.
|
int |
getBaselineSize()
Return the number of values to recall for the baseline.
|
java.lang.String |
getDatabase()
Returns the name of the database from which the facets in this set are
to be retrieved.
|
int |
getFetchFrom()
Returns the lowest (by sort order) ordinal number of the value to fetch.
|
int |
getFetchTo()
Returns the highest (by sort order) ordinal number of the value to fetch.
|
int |
getLowerFrequencyLimit()
Returns the lower limit of the facet frequency (value count) of facet
values to retrieve.
|
java.lang.String |
getName()
Returns the name or identity of this facet.
|
int |
getSearchSet()
Retrieve the search set number from which facet values are to be taken.
|
TdbFacetSortOrder |
getSortOrder()
Returns the sort order for the values of this facet.
|
int |
getTimeout()
Get timeout value in seconds for delay-loaded facets.
|
int |
getUpperFrequencyLimit()
Returns the upper limit of the facet frequency (value count) of facet
values to retrieve.
|
abstract TdbFacetValue |
getValue(int index)
Retrieve a facet value object.
|
int |
getValueCount()
Returns the total number of values associated with this facet.
|
boolean |
isRegisterBaseline()
Returns true if the facet values should be registered as a baseline.
|
boolean |
isUseBaseline()
Returns true a previously registered baseline should be used.
|
java.util.Iterator<TdbFacetValue> |
iterator()
Returns an iterator over the values in this facet.
|
void |
setBaselineKey(java.lang.String key)
Set a key identifying the facet baseline to set or use.
|
void |
setBaselineSize(int size)
Set the number of values to recall for the baseline.
|
void |
setDatabase(java.lang.String database)
Assigns the name of the database from which the facets in this set are
to be retrieved.
|
void |
setFetchFrom(int fetchFrom)
Assigns the lowest (by sort order) ordinal number of the value to fetch.
|
void |
setFetchTo(int fetchTo)
Assigns the highest (by sort order) ordinal number of the value to fetch.
|
void |
setFrequencyLimits(int lowerLimit,
int upperLimit)
Assigns the upper and lower limits of the facet frequency (value count)
of facet values to retrieve.
|
void |
setRegisterBaseline(boolean enable)
Register the facet results for this facet as a baseline.
|
void |
setSearchSet(int searchSet)
Retrieve the search set number from which facet values are to be taken.
|
void |
setSortOrder(TdbFacetSortOrder sortOrder)
Sets the sort order for the values of this facet.
|
void |
setTimeout(int timeout)
Set timeout value in seconds for delay-loaded facets.
|
void |
setUseBaseline(boolean enable)
Set to true to use a previously registered baseline for this facet.
|
public java.util.Iterator<TdbFacetValue> iterator()
iterator
in interface java.lang.Iterable<TdbFacetValue>
public java.lang.String getName()
public java.lang.String getDatabase()
Note that cluster names are not valid here. In order to fetch facet values from a cluster, you need to use search set that contains records from the cluster.
public void setDatabase(java.lang.String database)
Note that cluster names are not valid here. In order to fetch facet values from a cluster, you need to use search set that contains records from the cluster.
database
- Database namepublic int getSearchSet()
public void setSearchSet(int searchSet)
searchSet
- Search set number or -1 for no search set.public int getValueCount()
public TdbFacetSortOrder getSortOrder()
public void setSortOrder(TdbFacetSortOrder sortOrder) throws TdbException
sortOrder
- Sort order type to use with this facetTdbException
- If the sort order type is not valid for this facetpublic int getFetchTo()
public void setFetchTo(int fetchTo)
fetchTo
- 1-based number of smallest facet value to fetch.public int getFetchFrom()
public void setFetchFrom(int fetchFrom)
fetchFrom
- 1-based number of lowest facet value to fetch.public int getLowerFrequencyLimit()
public int getUpperFrequencyLimit()
public void setFrequencyLimits(int lowerLimit, int upperLimit)
lowerLimit
- Lower limit or 0 for no limit.upperLimit
- Upper limit or 0 for no limit.public int getTimeout()
Facets with delay-loaded values cease to be accessible after this timeout period. If the timeout value is zero, timeout has been disabled. The default timeout is 120 seconds.
public void setTimeout(int timeout)
Facets with delay-loaded values cease to be accessible after this timeout period. If the timeout value is zero, timeout has been disabled. The default timeout is 120 seconds.
timeout
- Timeout value in secondspublic void setRegisterBaseline(boolean enable)
enable
- True to enable the creation of a baseline
The idea with a baseline is to enble recall of a previous, initial set of facet values so that a new facet request can 1) include the previous counts as a comparison, and 2) add values from the baseline to the new result if the new result is smaller than the requested range.
The baselines for all facets in a TdbFacetSet are registered at the same time, upon the next call to TdbFacetSet.get().
Even though each facet in a facet set can have its own baseline, there is only single collection of baselines. This means that using multiple TdbFacetSet instances in parallel in an appliction is not fully supported.
In order to use a previously established baseline, call the TdbFacet.setUseBaseline() method with the argument set to true. Either call setRegisterBaseline with the 'enable' argument set to false for that facet instance, or do not not call it at all.
public boolean isRegisterBaseline()
public void setBaselineSize(int size)
size
- The maximum number of values to store in the baseline (minimum 100).public int getBaselineSize()
public void setUseBaseline(boolean enable)
public boolean isUseBaseline()
public void setBaselineKey(java.lang.String key)
key
- Baseline keypublic java.lang.String getBaselineKey()
public abstract void close()
public void clear()
public abstract TdbFacetValue getValue(int index) throws TdbException
index
- 0-based index of facet valueTdbException
- If facet value could not be returned.