Package org.apache.lucene.sandbox.codecs.idversion

# Class VersionBlockTreeTermsWriter

java.lang.Object
org.apache.lucene.codecs.FieldsConsumer
org.apache.lucene.sandbox.codecs.idversion.VersionBlockTreeTermsWriter

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public final class VersionBlockTreeTermsWriter extends FieldsConsumer
This is just like `Lucene103BlockTreeTermsWriter`, except it also stores a version per term, and adds a method to its TermsEnum implementation to seekExact only if the version is >= the specified version. The version is added to the terms index to avoid seeking if no term in the block has a high enough version. The term blocks file is .tiv and the terms index extension is .tipv.

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

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_MAX_BLOCK_SIZE`
  Suggested default value for the `maxItemsInBlock` parameter to `VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)`.
  `static final int`
  `DEFAULT_MIN_BLOCK_SIZE`
  Suggested default value for the `minItemsInBlock` parameter to `VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)`.
  `static final int`
  `VERSION_CURRENT`
  Current terms format.
  `static final int`
  `VERSION_START`
  Initial terms format.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VersionBlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock)`
  Create a new writer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `void`
  `write(Fields fields, NormsProducer norms)`

  ### Methods inherited from class org.apache.lucene.codecs.FieldsConsumer

  `merge`

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

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

- ## Field Details

  - ### DEFAULT_MIN_BLOCK_SIZE

    public static final int DEFAULT_MIN_BLOCK_SIZE
    Suggested default value for the `minItemsInBlock` parameter to `VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)`.
    See Also:
      - Constant Field Values

  - ### DEFAULT_MAX_BLOCK_SIZE

    public static final int DEFAULT_MAX_BLOCK_SIZE
    Suggested default value for the `maxItemsInBlock` parameter to `VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)`.
    See Also:
      - Constant Field Values

  - ### VERSION_START

    public static final int VERSION_START
    Initial terms format.
    See Also:
      - Constant Field Values

  - ### VERSION_CURRENT

    public static final int VERSION_CURRENT
    Current terms format.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### VersionBlockTreeTermsWriter

    public VersionBlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock) throws IOException
    Create a new writer. The number of items (terms or sub-blocks) per block will aim to be between minItemsPerBlock and maxItemsPerBlock, though in some cases the blocks may be smaller than the min.
    Throws:
      `IOException`

- ## Method Details

  - ### write

    public void write(Fields fields, NormsProducer norms) throws IOException
    Specified by:
      `write` in class `FieldsConsumer`
    Throws:
      `IOException`

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Specified by:
      `close` in class `FieldsConsumer`
    Throws:
      `IOException`