Class PerFieldPostingsFormat.FieldsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.FieldsConsumer
-
- org.apache.lucene.codecs.perfield.PerFieldPostingsFormat.FieldsWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Enclosing class:
- PerFieldPostingsFormat
private class PerFieldPostingsFormat.FieldsWriter extends FieldsConsumer
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<java.io.Closeable>toClose(package private) SegmentWriteStatewriteState
-
Constructor Summary
Constructors Constructor Description FieldsWriter(SegmentWriteState writeState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.Map<PostingsFormat,PerFieldPostingsFormat.FieldsGroup>buildFieldsGroupMapping(java.lang.Iterable<java.lang.String> indexedFieldNames)voidclose()voidmerge(MergeState mergeState, NormsProducer norms)Merges in the fields from the readers inmergeState.voidwrite(Fields fields, NormsProducer norms)Write all fields, terms and postings.
-
-
-
Field Detail
-
writeState
final SegmentWriteState writeState
-
toClose
final java.util.List<java.io.Closeable> toClose
-
-
Constructor Detail
-
FieldsWriter
public FieldsWriter(SegmentWriteState writeState)
-
-
Method Detail
-
write
public void write(Fields fields, NormsProducer norms) throws java.io.IOException
Description copied from class:FieldsConsumerWrite 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.
- Specified by:
writein classFieldsConsumer- Throws:
java.io.IOException
-
merge
public void merge(MergeState mergeState, NormsProducer norms) throws java.io.IOException
Description copied from class:FieldsConsumerMerges in the fields from the readers inmergeState. The default implementation skips and maps around deleted documents, and callsFieldsConsumer.write(Fields,NormsProducer). Implementations can override this method for more sophisticated merging (bulk-byte copying, etc).- Overrides:
mergein classFieldsConsumer- Throws:
java.io.IOException
-
buildFieldsGroupMapping
private java.util.Map<PostingsFormat,PerFieldPostingsFormat.FieldsGroup> buildFieldsGroupMapping(java.lang.Iterable<java.lang.String> indexedFieldNames)
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classFieldsConsumer- Throws:
java.io.IOException
-
-