Package org.apache.lucene.codecs
Class FieldsConsumer
java.lang.Object
org.apache.lucene.codecs.FieldsConsumer
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
BlockTreeTermsWriter
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:
- FieldsConsumer is created by
PostingsFormat.fieldsConsumer(SegmentWriteState). - For each field,
addField(FieldInfo)is called, returning aTermsConsumerfor the field. - After all fields are added, the consumer is
close()d.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract TermsConsumerAdd a new fieldabstract voidclose()Called when we are done adding everything.voidmerge(MergeState mergeState, Fields fields) Called during merging to merge allFieldsfrom sub-readers.
-
Constructor Details
-
FieldsConsumer
protected FieldsConsumer()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
addField
Add a new field- Throws:
IOException
-
close
Called when we are done adding everything.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
merge
Called during merging to merge allFieldsfrom sub-readers. This must recurse to merge all postings (terms, docs, positions, etc.). APostingsFormatcan override this default implementation to do its own merging.- Throws:
IOException
-