Package org.apache.lucene.codecs
Class NormsConsumer
java.lang.Object
org.apache.lucene.codecs.NormsConsumer
- All Implemented Interfaces:
Closeable,AutoCloseable
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract 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.
-
Constructor Details
-
NormsConsumer
protected NormsConsumer()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
addNormsField
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
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
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
-