DirectPostingsFormat (Lucene 10.5.1 codecs API)
Description: declaration: package: org.apache.lucene.codecs.memory, class: DirectPostingsFormat

Package org.apache.lucene.codecs.memory

# Class DirectPostingsFormat

java.lang.Object
org.apache.lucene.codecs.PostingsFormat
org.apache.lucene.codecs.memory.DirectPostingsFormat

All Implemented Interfaces:
  `NamedSPILoader.NamedSPI`

public final class DirectPostingsFormat extends PostingsFormat
Wraps `Lucene104PostingsFormat` format for on-disk storage, but then at read time loads and stores all terms and postings directly in RAM as byte[], int[].

WARNING: This is exceptionally RAM intensive: it makes no effort to compress the postings data, storing terms as separate byte[] and postings as separate int[], but as a result it gives substantial increase in search performance.

This postings format supports `TermsEnum.ord()` and `TermsEnum.seekExact(long)`.

Because this holds all term bytes as a single byte[], you cannot have more than 2.1GB worth of term bytes in a single segment.

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

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.codecs.PostingsFormat

  `EMPTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DirectPostingsFormat()`
  `DirectPostingsFormat(int minSkipCount, int lowFreqCutoff)`
  minSkipCount is how many terms in a row must have the same prefix before we put a skip pointer down.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FieldsConsumer`
  `fieldsConsumer(SegmentWriteState state)`
  `FieldsProducer`
  `fieldsProducer(SegmentReadState state)`

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

  `availablePostingsFormats, forName, getName, reloadPostingsFormats, toString`

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

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

- ## Constructor Details

  - ### DirectPostingsFormat

    public DirectPostingsFormat()

  - ### DirectPostingsFormat

    public DirectPostingsFormat(int minSkipCount, int lowFreqCutoff)
    minSkipCount is how many terms in a row must have the same prefix before we put a skip pointer down. Terms with docFreq <= lowFreqCutoff will use a single int[] to hold all docs, freqs, position and offsets; terms with higher docFreq will use separate arrays.

- ## Method Details

  - ### fieldsConsumer

    public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException
    Specified by:
      `fieldsConsumer` in class `PostingsFormat`
    Throws:
      `IOException`

  - ### fieldsProducer

    public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException
    Specified by:
      `fieldsProducer` in class `PostingsFormat`
    Throws:
      `IOException`