Class TermsFacetMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,Object>
-
- org.apache.solr.client.solrj.request.json.JsonFacetMap<TermsFacetMap>
-
- org.apache.solr.client.solrj.request.json.TermsFacetMap
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,Object>
public class TermsFacetMap extends JsonFacetMap<TermsFacetMap>
Represents a "terms" facet in a JSON query request. Ready for use inJsonQueryRequest.withFacet(String, Map)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TermsFacetMap.FacetMethod
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description TermsFacetMap(String fieldName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TermsFacetMap
getThis()
TermsFacetMap
includeAllBucketsUnionBucket(boolean shouldInclude)
Creates a bucket representing the union of all other buckets.TermsFacetMap
includeMissingBucket(boolean missingBucket)
Indicates that Solr should create a bucket corresponding to documents missing the field used by this facet.TermsFacetMap
includeTotalNumBuckets(boolean numBuckets)
Indicates that Solr should include the total number of buckets for this facet.TermsFacetMap
setBucketOffset(int numToSkip)
Indicates that Solr should skip over the N buckets for this facet.TermsFacetMap
setFacetMethod(TermsFacetMap.FacetMethod method)
Indicate which method should be used to compute the facet.TermsFacetMap
setLimit(int maximumBuckets)
Indicates the maximum number of buckets to be returned by this facet.TermsFacetMap
setMinCount(int minCount)
Indicates that the facet results should not include any buckets with a count less thanminCount
.TermsFacetMap
setOverRefine(int numExtraBuckets)
Indicates how many extra buckets to request during distributed-facet-refining beyond those required bysetLimit(int)
Defaults to -1 if not specified, which triggers some heuristic guessing based on other settings.TermsFacetMap
setOverRequest(int numExtraBuckets)
Indicates the number of additional buckets to request internally beyond those required bysetLimit(int)
.TermsFacetMap
setPreliminarySort(String preliminarySort)
Indicates an approximate sort calculation to be performed during initial bucket generation and collection.TermsFacetMap
setSort(String sortString)
Indicates the desired ordering for the returned buckets.TermsFacetMap
setTermPrefix(String termPrefix)
Indicates that the facet should only produce buckets for terms that start with the specified prefix.TermsFacetMap
useDistributedFacetRefining(boolean useRefining)
Indicates whether this facet should use distributed facet refining.-
Methods inherited from class org.apache.solr.client.solrj.request.json.JsonFacetMap
withDomain, withStatSubFacet, withSubFacet
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Constructor Detail
-
TermsFacetMap
public TermsFacetMap(String fieldName)
-
-
Method Detail
-
getThis
public TermsFacetMap getThis()
- Specified by:
getThis
in classJsonFacetMap<TermsFacetMap>
-
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. Ifsort
is expensive a cheaper approximation can be provided usingsetPreliminarySort(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 noprelim_sort
is provided,sort
is calculated on all buckets generated by all shards. Ifsort
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 bysetLimit(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 bysetLimit(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 thanminCount
. 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.
-
-