Class FieldsConsumer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    BlockTreeTermsWriter

    public abstract class FieldsConsumer
    extends java.lang.Object
    implements java.io.Closeable
    Abstract API that consumes terms, doc, freq, prox, offset and payloads postings. Concrete implementations of this actually do "something" with the postings (write it into the index in a specific format).

    The lifecycle is:

    1. FieldsConsumer is created by PostingsFormat.fieldsConsumer(SegmentWriteState).
    2. For each field, addField(FieldInfo) is called, returning a TermsConsumer for the field.
    3. After all fields are added, the consumer is close()d.
    • Method Detail

      • addField

        public abstract TermsConsumer addField​(FieldInfo field)
                                        throws java.io.IOException
        Add a new field
        Throws:
        java.io.IOException
      • close

        public abstract void close()
                            throws java.io.IOException
        Called when we are done adding everything.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • merge

        public void merge​(MergeState mergeState,
                          Fields fields)
                   throws java.io.IOException
        Called during merging to merge all Fields from sub-readers. This must recurse to merge all postings (terms, docs, positions, etc.). A PostingsFormat can override this default implementation to do its own merging.
        Throws:
        java.io.IOException