org.apache.lucene.codecs
Class FieldsConsumer

java.lang.Object
  extended by org.apache.lucene.codecs.FieldsConsumer
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
BlockTreeTermsWriter

public abstract class FieldsConsumer
extends Object
implements 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).

The lifecycle is:

  1. FieldsConsumer is created by PostingsFormat.fieldsConsumer(SegmentWriteState).
  2. For each field, addField(FieldInfo) is called, returning a TermsConsumer for the field.
  3. After all fields are added, the consumer is close()d.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
protected FieldsConsumer()
          Sole constructor.
 
Method Summary
abstract  TermsConsumer addField(FieldInfo field)
          Add a new field
abstract  void close()
          Called when we are done adding everything.
 void merge(MergeState mergeState, Fields fields)
          Called during merging to merge all Fields from sub-readers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldsConsumer

protected FieldsConsumer()
Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Detail

addField

public abstract TermsConsumer addField(FieldInfo field)
                                throws IOException
Add a new field

Throws:
IOException

close

public abstract void close()
                    throws IOException
Called when we are done adding everything.

Specified by:
close in interface Closeable
Throws:
IOException

merge

public void merge(MergeState mergeState,
                  Fields fields)
           throws IOException
Called during merging to merge all Fields from sub-readers. This must recurse to merge all postings (terms, docs, positions, etc.). A PostingsFormat can override this default implementation to do its own merging.

Throws:
IOException


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.