Package org.apache.lucene.index

# Record Class LeafMetaData

java.lang.Object
java.lang.Record
org.apache.lucene.index.LeafMetaData

Record Components:
  `createdVersionMajor` - the Lucene version that created this index. This can be used to implement backward compatibility on top of the codec API. A return value of `6` indicates that the created version is unknown.
  `minVersion` - the minimum Lucene version that contributed documents to this index, or `null` if this information is not available.
  `sort` - the order in which documents from this index are sorted, or `null` if documents are in no particular order.
  `hasBlocks` - Returns `true` iff this index contains blocks created with `IndexWriter.addDocument(Iterable)` or it's corresponding update methods with at least 2 or more documents per call. Note: This property was not recorded before `Version.LUCENE_9_9_0` this method will return false for all leaves written before `Version.LUCENE_9_9_0`

public record LeafMetaData(int createdVersionMajor, Version minVersion, Sort sort, boolean hasBlocks) extends Record
Provides read-only metadata about a leaf.

See Also:
  - `IndexWriter.updateDocuments(Term, Iterable)`
  - `IndexWriter.updateDocuments(Query, Iterable)`
  - `IndexWriter.softUpdateDocuments(Term, Iterable, Field...)`
  - `IndexWriter.addDocuments(Iterable)`
WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LeafMetaData(int createdVersionMajor, Version minVersion, Sort sort, boolean hasBlocks)`
  Expert: Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `createdVersionMajor()`
  Returns the value of the `createdVersionMajor` record component.
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `boolean`
  `hasBlocks()`
  Returns the value of the `hasBlocks` record component.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `Version`
  `minVersion()`
  Returns the value of the `minVersion` record component.
  `Sort`
  `sort()`
  Returns the value of the `sort` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.

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

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

- ## Constructor Details

  - ### LeafMetaData

    public LeafMetaData(int createdVersionMajor, Version minVersion, Sort sort, boolean hasBlocks)
    Expert: Sole constructor. Public for use by custom `LeafReader` impls.

- ## Method Details

  - ### toString

    public final String toString()
    Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object

  - ### hashCode

    public final int hashCode()
    Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with `Objects::equals(Object,Object)`; primitive components are compared with '=='.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### createdVersionMajor

    public int createdVersionMajor()
    Returns the value of the `createdVersionMajor` record component.
    Returns:
      the value of the `createdVersionMajor` record component

  - ### minVersion

    public Version minVersion()
    Returns the value of the `minVersion` record component.
    Returns:
      the value of the `minVersion` record component

  - ### sort

    public Sort sort()
    Returns the value of the `sort` record component.
    Returns:
      the value of the `sort` record component

  - ### hasBlocks

    public boolean hasBlocks()
    Returns the value of the `hasBlocks` record component.
    Returns:
      the value of the `hasBlocks` record component