org.apache.lucene.codecs.idversion

## Class VersionBlockTreeTermsWriter

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

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public final class VersionBlockTreeTermsWriter
      extends FieldsConsumer

  This is just like `BlockTreeTermsWriter`, 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 and Description
    --- | ---
    `static int` | `DEFAULT_MAX_BLOCK_SIZE` Suggested default value for the `maxItemsInBlock` parameter to `VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)`.
    `static int` | `DEFAULT_MIN_BLOCK_SIZE` Suggested default value for the `minItemsInBlock` parameter to `VersionBlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)`.
    `static int` | `VERSION_CURRENT` Current terms format.
    `static int` | `VERSION_START` Initial terms format.

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 Detail

    - #### 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 Detail

    - #### 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 Detail

    - #### 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 `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in class `FieldsConsumer`
      Throws:
        `IOException`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.