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

Package org.apache.lucene.facet

# Class FacetField

java.lang.Object
org.apache.lucene.document.Field
org.apache.lucene.facet.FacetField

All Implemented Interfaces:
  `IndexableField`

public class FacetField extends Field
Add an instance of this to your `Document` for every facet label.

NOTE: you must call `FacetsConfig.build(Document)` before you add the document to IndexWriter.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.document.Field

  `Field.Store`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final String`
  `dim`
  Dimension for this field.
  `final String[]`
  `path`
  Path for this field.
  `static final FieldType`
  `TYPE`
  Field type used for storing facet values.

  ### Fields inherited from class org.apache.lucene.document.Field

  `fieldsData, name, type`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FacetField(String dim, String... path)`
  Creates this from `dim` and `path`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `toString()`
  `static void`
  `verifyLabel(String label)`
  Verifies the label is not null or empty string.

  ### Methods inherited from class org.apache.lucene.document.Field

  `binaryValue, fieldType, getCharSequenceValue, invertableType, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, storedValue, stringValue, tokenStream, tokenStreamValue`

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

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

- ## Field Details

  - ### TYPE

    public static final FieldType TYPE
    Field type used for storing facet values. Actual field type used for indexing is determined in `FacetsConfig.build(TaxonomyWriter, Document)`

  - ### dim

    public final String dim
    Dimension for this field.

  - ### path

    public final String[] path
    Path for this field.

- ## Constructor Details

  - ### FacetField

    public FacetField(String dim, String... path)
    Creates this from `dim` and `path`.

- ## Method Details

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Field`

  - ### verifyLabel

    public static void verifyLabel(String label)
    Verifies the label is not null or empty string.
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.