Package org.apache.lucene.codecs
Class FieldsConsumer
- java.lang.Object
-
- org.apache.lucene.codecs.FieldsConsumer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
BlockTreeTermsWriter
public abstract class FieldsConsumer extends Object implements 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:
- FieldsConsumer is created by
PostingsFormat.fieldsConsumer(SegmentWriteState)
. - For each field,
addField(FieldInfo)
is called, returning aTermsConsumer
for the field. - After all fields are added, the consumer is
close()
d.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FieldsConsumer()
Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract TermsConsumer
addField(FieldInfo field)
Add a new fieldabstract void
close()
Called when we are done adding everything.void
merge(MergeState mergeState, Fields fields)
Called during merging to merge allFields
from sub-readers.
-
-
-
Method Detail
-
addField
public abstract TermsConsumer addField(FieldInfo field) throws IOException
Add a new field- Throws:
IOException
-
close
public abstract void close() throws IOException
Called when we are done adding everything.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
merge
public void merge(MergeState mergeState, Fields fields) throws IOException
Called during merging to merge allFields
from sub-readers. This must recurse to merge all postings (terms, docs, positions, etc.). APostingsFormat
can override this default implementation to do its own merging.- Throws:
IOException
-
-