Class FacetRequest

    • 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
    • Constructor Detail

      • FacetRequest

        public FacetRequest()
      • FacetRequest

        public FacetRequest​(java.lang.String name)
      • 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.
      • setChildFacet

        public void setChildFacet​(FacetRequest request)
        Set the child FacetRequest 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.
      • 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 primary,
                                 Sort.SortOrder secondary)
        Sets the sort order and sort-by's.
        Parameters:
        sort - the sort-by
        primary - the primary sort order
        secondary - 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 as getMinBucketCount() except a null 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 as setMinBucketCount(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 as getDistributedMinBucketCount() except a null 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 as setDistributedMinBucketCount(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 as getMaxBuckets() except a null 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 as setMaxBuckets(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 as getDistributedMaxBuckets() except a null 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 as setDistributedMaxBuckets(int) except that null value indicates default should be used.
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • clone

        public FacetRequest clone()
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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 To buffer.
      • valueOf

        public static FacetRequest valueOf​(java.lang.String value)
        Parse a FacetRequest from a string.