Package org.apache.lucene.codecs
Class FieldsConsumer
- java.lang.Object
-
- org.apache.lucene.codecs.FieldsConsumer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
BlockTermsWriter
,BlockTreeTermsWriter
,BloomFilteringPostingsFormat.BloomFilteredFieldsConsumer
,CompletionFieldsConsumer
,FSTOrdTermsWriter
,FSTTermsWriter
,OrdsBlockTreeTermsWriter
,PerFieldPostingsFormat.FieldsWriter
,SimpleTextFieldsWriter
,UniformSplitTermsWriter
,VersionBlockTreeTermsWriter
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).
-
-
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 void
close()
void
merge(MergeState mergeState, NormsProducer norms)
Merges in the fields from the readers inmergeState
.abstract void
write(Fields fields, NormsProducer norms)
Write all fields, terms and postings.
-
-
-
Method Detail
-
write
public abstract void write(Fields fields, NormsProducer norms) throws java.io.IOException
Write all fields, terms and postings. This the "pull" API, allowing you to iterate more than once over the postings, somewhat analogous to using a DOM API to traverse an XML tree.Notes:
- You must compute index statistics, including each Term's docFreq and totalTermFreq, as well as the summary sumTotalTermFreq, sumTotalDocFreq and docCount.
- You must skip terms that have no docs and fields that have no terms, even though the provided Fields API will expose them; this typically requires lazily writing the field or term until you've actually seen the first term or document.
- The provided Fields instance is limited: you cannot call any methods that return statistics/counts; you cannot pass a non-null live docs when pulling docs/positions enums.
- Throws:
java.io.IOException
-
merge
public void merge(MergeState mergeState, NormsProducer norms) throws java.io.IOException
Merges in the fields from the readers inmergeState
. The default implementation skips and maps around deleted documents, and callswrite(Fields,NormsProducer)
. Implementations can override this method for more sophisticated merging (bulk-byte copying, etc).- Throws:
java.io.IOException
-
close
public abstract void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-