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.Serializable
Represents 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 class
FacetRequest.SortBy
Enumeration listing types of sorts for a facet request
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_MAX_MEMORY_USAGE
Default max memory usage (512K).static Sort.SortOrder
DEFAULT_PRIMARY_SORT
Default primary Sortstatic ShallowMode
DEFAULT_SAMPLE_MODE
Default sample mode for date facets (POPULATION)static Sort.SortOrder
DEFAULT_SECONDARY_SORT
Default secondary Sortstatic FacetRequest.SortBy
DEFAULT_SORT_BY
Default sort by
-
Constructor Summary
Constructors Modifier Constructor Description FacetRequest()
protected
FacetRequest(boolean facetFinder)
FacetRequest(FieldExpression field)
protected
FacetRequest(FieldExpression field, boolean facetFinder)
FacetRequest(java.lang.String name)
protected
FacetRequest(java.lang.String name, boolean facetFinder)
FacetRequest(java.lang.String name, FieldExpression field)
protected
FacetRequest(java.lang.String name, FieldExpression field, boolean facetFinder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
addName(java.lang.StringBuilder buffer)
protected int
addParameter(java.lang.StringBuilder buffer, int index, java.lang.String key, java.lang.Object value)
Add A REST Parameter Tobuffer
.protected int
addParameters(java.lang.StringBuilder buffer, int index)
FacetRequest
clone()
boolean
equals(java.lang.Object other)
FacetRequest
getChildFacet()
Get the childFacetRequest
for multi-dimensional facets.int
getDistributedMaxBuckets()
Get the number of buckets to return from distributed indexes.int
getDistributedMinBucketCount()
Gets the minimum count that returned buckets must have for distributed indexes.java.lang.String
getField()
Get the field to request a facet for.FieldExpression
getFieldExpression()
Get theFieldExpression
to request a facet for.int
getMaxBuckets()
Get the maximum number of buckets to return.long
getMaxMemoryUsage()
Get the max memory usage allowed during computation (in bytes).int
getMinBucketCount()
Gets the minimum count that returned buckets must have.java.lang.String
getName()
Get the name for this facet request.Sort.SortOrder
getPrimarySortOrder()
Gets the primary sort order for sorting buckets.java.lang.Integer
getRawDistributedMaxBuckets()
Same asgetDistributedMaxBuckets()
except anull
value is returned if no value is set.java.lang.Integer
getRawDistributedMinBucketCount()
Same asgetDistributedMinBucketCount()
except anull
value is returned if no value is set.java.lang.Integer
getRawMaxBuckets()
Same asgetMaxBuckets()
except anull
value is returned if no value is set.java.lang.Integer
getRawMinBucketCount()
Same asgetMinBucketCount()
except anull
value is returned if no value is set.Sort.SortOrder
getSecondarySortOrder()
Gets the secondary sort order for sorting buckets.ShallowMode
getShallowMode()
Get the sample mode for facet computation.FacetRequest.SortBy
getSortBy()
Get the field to sort buckets byint
hashCode()
boolean
isCalculateStatistics()
Should statistics be calculated.boolean
isFacetFinder()
true
if the facet finder can replace this FacetRequest with a suggested FacetRequest.void
setCalculateStatistics(boolean value)
Set if statistics should be calculated.void
setChildFacet(FacetRequest request)
Set the childFacetRequest
for multi-dimensional facets.void
setDefaults(SchemaField schemaField)
Set default values for unset fields based on a SchemaField.void
setDistributedMaxBuckets(int value)
Set the number of buckets to return from distributed indexes.void
setDistributedMaxBuckets(java.lang.Integer value)
Same assetDistributedMaxBuckets(int)
except that null value indicates default should be used.void
setDistributedMinBucketCount(int value)
Sets the minimum count that returned buckets must have for distributed indexes.void
setDistributedMinBucketCount(java.lang.Integer value)
Same assetDistributedMinBucketCount(int)
except that null value indicates default should be used.void
setFacetFinder(boolean value)
Set if FacetFinder is allowed to provide a suggestion for this FacetRequest.void
setField(java.lang.String value)
Set the field to request a facet for.void
setFieldExpression(FieldExpression value)
Set theFieldExpression
to request a facet for.void
setMaxBuckets(int numBuckets)
Set the maximum number of buckets to return.void
setMaxBuckets(java.lang.Integer value)
Same assetMaxBuckets(int)
except that null value indicates default should be used.void
setMaxMemoryUsage(long value)
Set the max memory usage allowed during computation (in bytes).void
setMinBucketCount(int value)
Sets the minimum count that returned buckets must have.void
setMinBucketCount(java.lang.Integer value)
Same assetMinBucketCount(int)
except that null value indicates default should be used.void
setName(java.lang.String value)
Set the name for this facet request.void
setPrimarySortOrder(Sort.SortOrder order)
Sets the primary sort order for sorting buckets.void
setSecondarySortOrder(Sort.SortOrder order)
Sets the secondary sort order for sorting buckets.void
setShallowMode(ShallowMode value)
Set the sample mode for facet computation.void
setSortOrder(FacetRequest.SortBy sort)
Sets wether to sort by bucket count or bucket label.void
setSortOrder(FacetRequest.SortBy sort, Sort.SortOrder order)
Sets wether to sort by bucket count or bucket label.void
setSortOrder(FacetRequest.SortBy sort, Sort.SortOrder primary, Sort.SortOrder secondary)
Sets the sort order and sort-by's.protected FacetRequestFactory
toFacetBuilder()
java.lang.String
toString()
protected static FacetRequest
valueOf(FacetRequestFactory value)
static FacetRequest
valueOf(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 theFieldExpression
to request a facet for.
-
setFieldExpression
public void setFieldExpression(FieldExpression value)
Set theFieldExpression
to request a facet for.
-
getChildFacet
public FacetRequest getChildFacet()
Get the childFacetRequest
for multi-dimensional facets.
-
setChildFacet
public void setChildFacet(FacetRequest request)
Set the childFacetRequest
for 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()
true
if 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 anull
value 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 anull
value 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 anull
value 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 anull
value 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
clone
public FacetRequest clone()
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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)
-
-