VariableGapTermsIndexWriter (Lucene 10.5.0 codecs API)
Description: declaration: package: org.apache.lucene.codecs.blockterms, class: VariableGapTermsIndexWriter

Package org.apache.lucene.codecs.blockterms

# Class VariableGapTermsIndexWriter

java.lang.Object
org.apache.lucene.codecs.blockterms.TermsIndexWriterBase
org.apache.lucene.codecs.blockterms.VariableGapTermsIndexWriter

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class VariableGapTermsIndexWriter extends TermsIndexWriterBase
Selects index terms according to provided pluggable `VariableGapTermsIndexWriter.IndexTermSelector`, and stores them in a prefix trie that's loaded entirely in RAM stored as an FST. This terms index only supports unsigned byte term sort order (unicode codepoint order when the bytes are UTF8).

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

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `VariableGapTermsIndexWriter.EveryNOrDocFreqTermSelector`
  Sets an index term when docFreq >= docFreqThresh, or every interval terms.
  `static final class`
  `VariableGapTermsIndexWriter.EveryNTermSelector`
  Same policy as `FixedGapTermsIndexWriter`
  `static class`
  `VariableGapTermsIndexWriter.IndexTermSelector`
  Hook for selecting which terms should be placed in the terms index.

  ## Nested classes/interfaces inherited from class org.apache.lucene.codecs.blockterms.TermsIndexWriterBase

  `TermsIndexWriterBase.FieldWriter`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected IndexOutput`
  `metaOut`
  `protected IndexOutput`
  `out`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VariableGapTermsIndexWriter(SegmentWriteState state, VariableGapTermsIndexWriter.IndexTermSelector policy)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TermsIndexWriterBase.FieldWriter`
  `addField(FieldInfo field, long termsFilePointer)`
  `void`
  `close()`
  `protected int`
  `indexedTermPrefixLength(BytesRef priorTerm, BytesRef indexedTerm)`
  NOTE: if your codec does not sort in unicode code point order, you must override this method, to simply return indexedTerm.length.

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

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

- ## Field Details

  - ### metaOut

    protected IndexOutput metaOut

  - ### out

    protected IndexOutput out

- ## Constructor Details

  - ### VariableGapTermsIndexWriter

    public VariableGapTermsIndexWriter(SegmentWriteState state, VariableGapTermsIndexWriter.IndexTermSelector policy) throws IOException
    Throws:
      `IOException`

- ## Method Details

  - ### addField

    public TermsIndexWriterBase.FieldWriter addField(FieldInfo field, long termsFilePointer) throws IOException
    Specified by:
      `addField` in class `TermsIndexWriterBase`
    Throws:
      `IOException`

  - ### indexedTermPrefixLength

    protected int indexedTermPrefixLength(BytesRef priorTerm, BytesRef indexedTerm)
    NOTE: if your codec does not sort in unicode code point order, you must override this method, to simply return indexedTerm.length.

  - ### close

    public void close() throws IOException
    Throws:
      `IOException`