Class FacetRequest
- java.lang.Object
-
- com.attivio.sdk.search.facet.FacetRequest
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
DateFacetRequest,FilterBasedFacetRequest,RangeFacetRequest,SchemaFacetRequest,ScopeFacetRequest
public class FacetRequest extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableRepresents a generic Facet Request based on the value of a field.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFacetRequest.SortByEnumeration listing types of sorts for a facet request
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_MAX_MEMORY_USAGEDefault max memory usage (512K).static Sort.SortOrderDEFAULT_PRIMARY_SORTDefault primary Sortstatic ShallowModeDEFAULT_SAMPLE_MODEDefault sample mode for date facets (POPULATION)static Sort.SortOrderDEFAULT_SECONDARY_SORTDefault secondary Sortstatic FacetRequest.SortByDEFAULT_SORT_BYDefault sort by
-
Constructor Summary
Constructors Modifier Constructor Description FacetRequest()protectedFacetRequest(boolean facetFinder)FacetRequest(FieldExpression field)protectedFacetRequest(FieldExpression field, boolean facetFinder)FacetRequest(java.lang.String name)protectedFacetRequest(java.lang.String name, boolean facetFinder)FacetRequest(java.lang.String name, FieldExpression field)protectedFacetRequest(java.lang.String name, FieldExpression field, boolean facetFinder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intaddName(java.lang.StringBuilder buffer)protected intaddParameter(java.lang.StringBuilder buffer, int index, java.lang.String key, java.lang.Object value)Add A REST Parameter Tobuffer.protected intaddParameters(java.lang.StringBuilder buffer, int index)FacetRequestclone()booleanequals(java.lang.Object other)FacetRequestgetChildFacet()Get the childFacetRequestfor multi-dimensional facets.intgetDistributedMaxBuckets()Get the number of buckets to return from distributed indexes.intgetDistributedMinBucketCount()Gets the minimum count that returned buckets must have for distributed indexes.java.lang.StringgetField()Get the field to request a facet for.FieldExpressiongetFieldExpression()Get theFieldExpressionto request a facet for.intgetMaxBuckets()Get the maximum number of buckets to return.longgetMaxMemoryUsage()Get the max memory usage allowed during computation (in bytes).intgetMinBucketCount()Gets the minimum count that returned buckets must have.java.lang.StringgetName()Get the name for this facet request.Sort.SortOrdergetPrimarySortOrder()Gets the primary sort order for sorting buckets.java.lang.IntegergetRawDistributedMaxBuckets()Same asgetDistributedMaxBuckets()except anullvalue is returned if no value is set.java.lang.IntegergetRawDistributedMinBucketCount()Same asgetDistributedMinBucketCount()except anullvalue is returned if no value is set.java.lang.IntegergetRawMaxBuckets()Same asgetMaxBuckets()except anullvalue is returned if no value is set.java.lang.IntegergetRawMinBucketCount()Same asgetMinBucketCount()except anullvalue is returned if no value is set.Sort.SortOrdergetSecondarySortOrder()Gets the secondary sort order for sorting buckets.ShallowModegetShallowMode()Get the sample mode for facet computation.FacetRequest.SortBygetSortBy()Get the field to sort buckets byinthashCode()booleanisCalculateStatistics()Should statistics be calculated.booleanisFacetFinder()trueif the facet finder can replace this FacetRequest with a suggested FacetRequest.voidsetCalculateStatistics(boolean value)Set if statistics should be calculated.voidsetChildFacet(FacetRequest request)Set the childFacetRequestfor multi-dimensional facets.voidsetDefaults(SchemaField schemaField)Set default values for unset fields based on a SchemaField.voidsetDistributedMaxBuckets(int value)Set the number of buckets to return from distributed indexes.voidsetDistributedMaxBuckets(java.lang.Integer value)Same assetDistributedMaxBuckets(int)except that null value indicates default should be used.voidsetDistributedMinBucketCount(int value)Sets the minimum count that returned buckets must have for distributed indexes.voidsetDistributedMinBucketCount(java.lang.Integer value)Same assetDistributedMinBucketCount(int)except that null value indicates default should be used.voidsetFacetFinder(boolean value)Set if FacetFinder is allowed to provide a suggestion for this FacetRequest.voidsetField(java.lang.String value)Set the field to request a facet for.voidsetFieldExpression(FieldExpression value)Set theFieldExpressionto request a facet for.voidsetMaxBuckets(int numBuckets)Set the maximum number of buckets to return.voidsetMaxBuckets(java.lang.Integer value)Same assetMaxBuckets(int)except that null value indicates default should be used.voidsetMaxMemoryUsage(long value)Set the max memory usage allowed during computation (in bytes).voidsetMinBucketCount(int value)Sets the minimum count that returned buckets must have.voidsetMinBucketCount(java.lang.Integer value)Same assetMinBucketCount(int)except that null value indicates default should be used.voidsetName(java.lang.String value)Set the name for this facet request.voidsetPrimarySortOrder(Sort.SortOrder order)Sets the primary sort order for sorting buckets.voidsetSecondarySortOrder(Sort.SortOrder order)Sets the secondary sort order for sorting buckets.voidsetShallowMode(ShallowMode value)Set the sample mode for facet computation.voidsetSortOrder(FacetRequest.SortBy sort)Sets wether to sort by bucket count or bucket label.voidsetSortOrder(FacetRequest.SortBy sort, Sort.SortOrder order)Sets wether to sort by bucket count or bucket label.voidsetSortOrder(FacetRequest.SortBy sort, Sort.SortOrder primary, Sort.SortOrder secondary)Sets the sort order and sort-by's.protected FacetRequestFactorytoFacetBuilder()java.lang.StringtoString()protected static FacetRequestvalueOf(FacetRequestFactory value)static FacetRequestvalueOf(java.lang.String value)Parse a FacetRequest from a string.
-
-
-
Field Detail
-
DEFAULT_MAX_MEMORY_USAGE
public static final long DEFAULT_MAX_MEMORY_USAGE
Default max memory usage (512K).- See Also:
- Constant Field Values
-
DEFAULT_SAMPLE_MODE
public static ShallowMode DEFAULT_SAMPLE_MODE
Default sample mode for date facets (POPULATION)
-
DEFAULT_PRIMARY_SORT
public static final Sort.SortOrder DEFAULT_PRIMARY_SORT
Default primary Sort
-
DEFAULT_SECONDARY_SORT
public static final Sort.SortOrder DEFAULT_SECONDARY_SORT
Default secondary Sort
-
DEFAULT_SORT_BY
public static final FacetRequest.SortBy DEFAULT_SORT_BY
Default sort by
-
-
Constructor Detail
-
FacetRequest
public FacetRequest()
-
FacetRequest
public FacetRequest(java.lang.String name)
-
FacetRequest
public FacetRequest(FieldExpression field)
-
FacetRequest
public FacetRequest(java.lang.String name, FieldExpression field)
-
FacetRequest
protected FacetRequest(boolean facetFinder)
-
FacetRequest
protected FacetRequest(java.lang.String name, boolean facetFinder)
-
FacetRequest
protected FacetRequest(FieldExpression field, boolean facetFinder)
-
FacetRequest
protected FacetRequest(java.lang.String name, FieldExpression field, boolean facetFinder)
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name for this facet request.
-
setName
public void setName(java.lang.String value)
Set the name for this facet request.
-
getField
public java.lang.String getField()
Get the field to request a facet for.
-
setField
public void setField(java.lang.String value)
Set the field to request a facet for.
-
getFieldExpression
public FieldExpression getFieldExpression()
Get theFieldExpressionto request a facet for.
-
setFieldExpression
public void setFieldExpression(FieldExpression value)
Set theFieldExpressionto request a facet for.
-
getChildFacet
public FacetRequest getChildFacet()
Get the childFacetRequestfor multi-dimensional facets.
-
setChildFacet
public void setChildFacet(FacetRequest request)
Set the childFacetRequestfor multi-dimensional facets.
-
getShallowMode
public ShallowMode getShallowMode()
Get the sample mode for facet computation.
-
setShallowMode
public void setShallowMode(ShallowMode value)
Set the sample mode for facet computation.
-
getMaxMemoryUsage
public final long getMaxMemoryUsage()
Get the max memory usage allowed during computation (in bytes).If the facet contains more data than can fit in this space, its computation will be buffered on disk.
NOTE: this is a hint. not all facet implementations support memory limitations.
-
setMaxMemoryUsage
public final void setMaxMemoryUsage(long value)
Set the max memory usage allowed during computation (in bytes).
-
isFacetFinder
public boolean isFacetFinder()
trueif the facet finder can replace this FacetRequest with a suggested FacetRequest.This will replace a FacetRequest for a numeric field with a RangeFacetRequest when facet finder runs.
-
setFacetFinder
public void setFacetFinder(boolean value)
Set if FacetFinder is allowed to provide a suggestion for this FacetRequest.
-
isCalculateStatistics
public boolean isCalculateStatistics()
Should statistics be calculated.
-
setCalculateStatistics
public void setCalculateStatistics(boolean value)
Set if statistics should be calculated.
-
getSortBy
public FacetRequest.SortBy getSortBy()
Get the field to sort buckets by
-
setDefaults
public void setDefaults(SchemaField schemaField)
Set default values for unset fields based on a SchemaField.
-
setSortOrder
public void setSortOrder(FacetRequest.SortBy sort)
Sets wether to sort by bucket count or bucket label.
-
setSortOrder
public void setSortOrder(FacetRequest.SortBy sort, Sort.SortOrder order)
Sets wether to sort by bucket count or bucket label.
-
setSortOrder
public void setSortOrder(FacetRequest.SortBy sort, Sort.SortOrder primary, Sort.SortOrder secondary)
Sets the sort order and sort-by's.- Parameters:
sort- the sort-byprimary- the primary sort ordersecondary- the secondary sort order
-
setPrimarySortOrder
public void setPrimarySortOrder(Sort.SortOrder order)
Sets the primary sort order for sorting buckets.
-
getPrimarySortOrder
public Sort.SortOrder getPrimarySortOrder()
Gets the primary sort order for sorting buckets.
-
setSecondarySortOrder
public void setSecondarySortOrder(Sort.SortOrder order)
Sets the secondary sort order for sorting buckets.
-
getSecondarySortOrder
public Sort.SortOrder getSecondarySortOrder()
Gets the secondary sort order for sorting buckets.
-
getMinBucketCount
public int getMinBucketCount()
Gets the minimum count that returned buckets must have.Buckets will not be returned if their counts are less than this value.
-
getRawMinBucketCount
public java.lang.Integer getRawMinBucketCount()
Same asgetMinBucketCount()except anullvalue is returned if no value is set.
-
setMinBucketCount
public void setMinBucketCount(int value)
Sets the minimum count that returned buckets must have.Buckets will not be returned if their counts are less than this value.
-
setMinBucketCount
public void setMinBucketCount(java.lang.Integer value)
Same assetMinBucketCount(int)except that null value indicates default should be used.
-
getDistributedMinBucketCount
public int getDistributedMinBucketCount()
Gets the minimum count that returned buckets must have for distributed indexes.PERFORMANCE vs ACCURACY: this value is used for tuning performance of faceting in a distributed index setup. If this value is set to 0, bucket counts will accurate, however network traffic will increase. Increasing the value for this setting will reduce network traffic, however accuracy will decrease.
-
getRawDistributedMinBucketCount
public java.lang.Integer getRawDistributedMinBucketCount()
Same asgetDistributedMinBucketCount()except anullvalue is returned if no value is set.
-
setDistributedMinBucketCount
public void setDistributedMinBucketCount(int value)
Sets the minimum count that returned buckets must have for distributed indexes.PERFORMANCE vs ACCURACY: this value is used for tuning performance of faceting in a distributed index setup. If this value is set to 0, bucket counts will accurate, however network traffic will increase. Increasing the value for this setting will reduce network traffic, however accuracy will decrease.
-
setDistributedMinBucketCount
public void setDistributedMinBucketCount(java.lang.Integer value)
Same assetDistributedMinBucketCount(int)except that null value indicates default should be used.
-
getMaxBuckets
public int getMaxBuckets()
Get the maximum number of buckets to return.
-
getRawMaxBuckets
public java.lang.Integer getRawMaxBuckets()
Same asgetMaxBuckets()except anullvalue is returned if no value is set.
-
setMaxBuckets
public void setMaxBuckets(int numBuckets)
Set the maximum number of buckets to return.
-
setMaxBuckets
public void setMaxBuckets(java.lang.Integer value)
Same assetMaxBuckets(int)except that null value indicates default should be used.
-
getDistributedMaxBuckets
public int getDistributedMaxBuckets()
Get the number of buckets to return from distributed indexes.PERFORMANCE vs ACCURACY: this value is used for tuning performance of faceting in a distributed index setup. If this value is unset, then all buckets from sub indexes will be returned upwards (resulting in accurate counts). If this value is set, then not all buckets will be passed up from sub indexes. This will result in better network throughput, however bucket counts accuracy will suffer.
-
getRawDistributedMaxBuckets
public java.lang.Integer getRawDistributedMaxBuckets()
Same asgetDistributedMaxBuckets()except anullvalue is returned if no value is set.
-
setDistributedMaxBuckets
public void setDistributedMaxBuckets(int value)
Set the number of buckets to return from distributed indexes.PERFORMANCE vs ACCURACY: this value is used for tuning performance of faceting in a distributed index setup. If this value is unset, then all buckets from sub indexes will be returned upwards (resulting in accurate counts). If this value is set, then not all buckets will be passed up from sub indexes. This will result in better network throughput, however bucket counts accuracy will suffer.
-
setDistributedMaxBuckets
public void setDistributedMaxBuckets(java.lang.Integer value)
Same assetDistributedMaxBuckets(int)except that null value indicates default should be used.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
clone
public FacetRequest clone()
- Overrides:
clonein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
addName
protected int addName(java.lang.StringBuilder buffer)
-
addParameters
protected int addParameters(java.lang.StringBuilder buffer, int index)
-
addParameter
protected final int addParameter(java.lang.StringBuilder buffer, int index, java.lang.String key, java.lang.Object value)Add A REST Parameter Tobuffer.
-
valueOf
public static FacetRequest valueOf(java.lang.String value)
Parse a FacetRequest from a string.
-
toFacetBuilder
protected FacetRequestFactory toFacetBuilder()
-
valueOf
protected static FacetRequest valueOf(FacetRequestFactory value)
-
-