Class TermsFacetMap

    • Constructor Detail

      • TermsFacetMap

        public TermsFacetMap​(String fieldName)
    • Method Detail

      • setBucketOffset

        public TermsFacetMap setBucketOffset​(int numToSkip)
        Indicates that Solr should skip over the N buckets for this facet.

        Used for "paging" in facet results. Defaults to 0 if not provided.

        Parameters:
        numToSkip - the number of buckets to skip over before selecting the buckets to return
      • setLimit

        public TermsFacetMap setLimit​(int maximumBuckets)
        Indicates the maximum number of buckets to be returned by this facet.

        Defaults to 10 if not specified.

      • setSort

        public TermsFacetMap setSort​(String sortString)
        Indicates the desired ordering for the returned buckets.

        Values can be based on 'count' (the number of results in each bucket), 'index' (the natural order of bucket values), or on any stat facet that occurs in the bucket. Defaults to "count desc" if not specified.

        By default, sort is calculated for all buckets generated by all shards. If sort is expensive a cheaper approximation can be provided using setPreliminarySort(String) that will be run instead during bucket collection.

        See Also:
        setPreliminarySort(String)
      • setPreliminarySort

        public TermsFacetMap setPreliminarySort​(String preliminarySort)
        Indicates an approximate sort calculation to be performed during initial bucket generation and collection.

        Values can be based on 'count' (the number of results in each bucket), 'index' (the natural order of bucket values), or on any stat facet that occurs in the bucket. Defaults to "count desc" if not specified.

        When no prelim_sort is provided, sort is calculated on all buckets generated by all shards. If sort is expensive, prelim_sort can be used to provide a cheaper approximation calculation that is run instead on initial bucket collection. sort is still used when assembling the final list of buckets.

        See Also:
        setSort(String)
      • setOverRequest

        public TermsFacetMap setOverRequest​(int numExtraBuckets)
        Indicates the number of additional buckets to request internally beyond those required by setLimit(int).

        Defaults to -1 if not specified, which triggers some heuristic guessing based on other settings.

      • useDistributedFacetRefining

        public TermsFacetMap useDistributedFacetRefining​(boolean useRefining)
        Indicates whether this facet should use distributed facet refining.

        "Distributed facet refining" is a second, optional stage in the facet process that ensures that counts for the returned buckets are exact. Enabling it is a tradeoff between precision and speed/performance. Defaults to false if not specified.

        Parameters:
        useRefining - true if distributed facet refining should be used; false otherwise
      • setOverRefine

        public TermsFacetMap setOverRefine​(int numExtraBuckets)
        Indicates how many extra buckets to request during distributed-facet-refining beyond those required by setLimit(int)

        Defaults to -1 if not specified, which triggers some heuristic guessing based on other settings.

      • setMinCount

        public TermsFacetMap setMinCount​(int minCount)
        Indicates that the facet results should not include any buckets with a count less than minCount.

        Defaults to 1 if not specified.

      • includeMissingBucket

        public TermsFacetMap includeMissingBucket​(boolean missingBucket)
        Indicates that Solr should create a bucket corresponding to documents missing the field used by this facet.

        Defaults to false if not specified.

        Parameters:
        missingBucket - true if the special "missing" bucket should be created; false otherwise
      • includeTotalNumBuckets

        public TermsFacetMap includeTotalNumBuckets​(boolean numBuckets)
        Indicates that Solr should include the total number of buckets for this facet.

        Note that this is different than the number of buckets returned. Defaults to false if not specified

        Parameters:
        numBuckets - true if the "numBuckets" field should be computed; false otherwise
      • includeAllBucketsUnionBucket

        public TermsFacetMap includeAllBucketsUnionBucket​(boolean shouldInclude)
        Creates a bucket representing the union of all other buckets.

        For multi-valued fields this is different than a bucket for the entire domain, since documents can belong to multiple buckets. Defaults to false if not specified.

        Parameters:
        shouldInclude - true if the union bucket "allBuckets" should be computed; false otherwise
      • setTermPrefix

        public TermsFacetMap setTermPrefix​(String termPrefix)
        Indicates that the facet should only produce buckets for terms that start with the specified prefix.
      • setFacetMethod

        public TermsFacetMap setFacetMethod​(TermsFacetMap.FacetMethod method)
        Indicate which method should be used to compute the facet.

        Defaults to "smart" if not specified, which has Solr guess which computation method will be most efficient.