Class BucketBasedJsonFacet

java.lang.Object
org.apache.solr.client.solrj.response.json.BucketBasedJsonFacet

public class BucketBasedJsonFacet extends Object
Represents the top-level response for a bucket-based JSON facet (i.e. "terms" or "range")

Allows access to JSON like:

   {
     "numBuckets": 2,
     "buckets": [
       {...},
       {...}
     ]
   }
 

Allows access to all top-level "terms" and "range" response properties (e.g. allBuckets, numBuckets, before, etc.)

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BucketBasedJsonFacet(NamedList<?> bucketBasedFacet)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    The count of all records whose field value follows the end of this "range" facet
    long
    The sum cardinality of all buckets in the "terms" facet.
    long
    The count of all records whose field value precedes the start of this "range" facet
    long
    The count of all records whose field value falls between start and end.
    Retrieves the facet buckets returned by the server.
    long
    The total number of buckets found in the domain (of which the returned buckets are only a part).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • BucketBasedJsonFacet

      public BucketBasedJsonFacet(NamedList<?> bucketBasedFacet)
  • Method Details

    • getBuckets

      public List<BucketJsonFacet> getBuckets()
      Retrieves the facet buckets returned by the server.
    • getNumBuckets

      public long getNumBuckets()
      The total number of buckets found in the domain (of which the returned buckets are only a part).

      This value can only be computed on "terms" facets where the user has specifically requested it with the numBuckets option. UNSET_FLAG is returned if this is a "range" facet or numBuckets computation was not requested in the initial request.

    • getAllBuckets

      public long getAllBuckets()
      The sum cardinality of all buckets in the "terms" facet.

      Note that for facets on multi-valued fields, documents may belong to multiple buckets, making getAllBuckets() return a result greater than the number of documents in the domain.

      This value is only present if the user has specifically requested it with the allBuckets option. UNSET_FLAG is returned if this is not the case.

    • getBefore

      public long getBefore()
      The count of all records whose field value precedes the start of this "range" facet

      This value is only present if the user has specifically requested it with the other option. UNSET_FLAG is returned if this is not the case.

    • getAfter

      public long getAfter()
      The count of all records whose field value follows the end of this "range" facet

      This value is only present if the user has specifically requested it with the other option. UNSET_FLAG is returned if this is not the case.

    • getBetween

      public long getBetween()
      The count of all records whose field value falls between start and end.

      This value is only present if the user has specifically requested it with the other option. UNSET_FLAG is returned if this is not the case.