FacetSet (Lucene 10.5.1 facet API)
Description: declaration: package: org.apache.lucene.facet.facetset, class: FacetSet

Package org.apache.lucene.facet.facetset

# Class FacetSet

java.lang.Object
org.apache.lucene.facet.facetset.FacetSet

Direct Known Subclasses:
  `DoubleFacetSet`, `FloatFacetSet`, `IntFacetSet`, `LongFacetSet`

public abstract class FacetSet extends Object
Holds a set of facet dimension values.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final int`
  `dims`
  The number of dimension values in this set.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `FacetSet(int dims)`
  Constructs a new instance of a facet set with the given number of dimensions.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract long[]`
  `getComparableValues()`
  Returns the dimension values in this facet set as comparable longs.
  `int`
  `packValues(byte[] buf, int start)`
  Packs the dimension values into the given `byte[]` and returns the number of packed-values bytes.
  `int`
  `sizePackedBytes()`
  Returns the size of the packed values in this facet set.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### dims

    public final int dims
    The number of dimension values in this set.

- ## Constructor Details

  - ### FacetSet

    protected FacetSet(int dims)
    Constructs a new instance of a facet set with the given number of dimensions.

- ## Method Details

  - ### getComparableValues

    public abstract long[] getComparableValues()
    Returns the dimension values in this facet set as comparable longs.

  - ### packValues

    public int packValues(byte[] buf, int start)
    Packs the dimension values into the given `byte[]` and returns the number of packed-values bytes. The default implementation packs the `comparable values`, and you can override to implement your own scheme.

  - ### sizePackedBytes

    public int sizePackedBytes()
    Returns the size of the packed values in this facet set. If the value is unknown in advance (e.g. if the values are compressed), this method can return an upper limit. The default implementations returns `dims * Long.BYTES` per the default implementation of `packValues(byte[], int)`. You should override if you implement `packValues(byte[], int)` differently.