Package org.apache.lucene.codecs
Class NormsConsumer
- java.lang.Object
-
- org.apache.lucene.codecs.NormsConsumer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public abstract class NormsConsumer extends Object implements Closeable
Abstract 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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NormsConsumer()
Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addNormsField(FieldInfo field, NormsProducer normsProducer)
Writes normalization values for a field.void
merge(MergeState mergeState)
Merges in the fields from the readers inmergeState
.void
mergeNormsField(FieldInfo mergeFieldInfo, MergeState mergeState)
Merges the norms fromtoMerge
.
-
-
-
Method Detail
-
addNormsField
public abstract void addNormsField(FieldInfo field, NormsProducer normsProducer) throws IOException
Writes normalization values for a field.- Parameters:
field
- field informationnormsProducer
- NormsProducer of the numeric norm values- Throws:
IOException
- if an I/O error occurred.
-
merge
public void merge(MergeState mergeState) throws 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:
IOException
-
mergeNormsField
public void mergeNormsField(FieldInfo mergeFieldInfo, MergeState mergeState) throws 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:
IOException
-
-