Package org.apache.lucene.codecs
Class NormsConsumer
- java.lang.Object
-
- org.apache.lucene.codecs.NormsConsumer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
Lucene70NormsConsumer,Lucene80NormsConsumer,SimpleTextNormsFormat.SimpleTextNormsConsumer
public abstract class NormsConsumer extends java.lang.Object implements java.io.CloseableAbstract API that consumes normalization values. Concrete implementations of this actually do "something" with the norms (write it into the index in a specific format).The lifecycle is:
- NormsConsumer is created by
NormsFormat.normsConsumer(SegmentWriteState). addNormsField(org.apache.lucene.index.FieldInfo, org.apache.lucene.codecs.NormsProducer)is called for each field with normalization values. The API is a "pull" rather than "push", and the implementation is free to iterate over the values multiple times (Iterable.iterator()).- After all fields are added, the consumer is
Closeable.close()d.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classNormsConsumer.NumericDocValuesSubTracks state of one numeric sub-reader that we are merging
-
Constructor Summary
Constructors Modifier Constructor Description protectedNormsConsumer()Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddNormsField(FieldInfo field, NormsProducer normsProducer)Writes normalization values for a field.voidmerge(MergeState mergeState)Merges in the fields from the readers inmergeState.voidmergeNormsField(FieldInfo mergeFieldInfo, MergeState mergeState)Merges the norms fromtoMerge.
-
-
-
Method Detail
-
addNormsField
public abstract void addNormsField(FieldInfo field, NormsProducer normsProducer) throws java.io.IOException
Writes normalization values for a field.- Parameters:
field- field informationnormsProducer- NormsProducer of the numeric norm values- Throws:
java.io.IOException- if an I/O error occurred.
-
merge
public void merge(MergeState mergeState) throws java.io.IOException
Merges in the fields from the readers inmergeState. The default implementation callsmergeNormsField(org.apache.lucene.index.FieldInfo, org.apache.lucene.index.MergeState)for each field, filling segments with missing norms for the field with zeros. Implementations can override this method for more sophisticated merging (bulk-byte copying, etc).- Throws:
java.io.IOException
-
mergeNormsField
public void mergeNormsField(FieldInfo mergeFieldInfo, MergeState mergeState) throws java.io.IOException
Merges the norms fromtoMerge.The default implementation calls
addNormsField(org.apache.lucene.index.FieldInfo, org.apache.lucene.codecs.NormsProducer), passing an Iterable that merges and filters deleted documents on the fly.- Throws:
java.io.IOException
-
-