org.apache.lucene.codecs
Class PerDocConsumer

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

public abstract class PerDocConsumer
extends Object
implements Closeable

Abstract API that consumes per document values. Concrete implementations of this convert field values into a Codec specific format during indexing.

The PerDocConsumer API is accessible through the PostingsFormat - API providing per field consumers and producers for inverted data (terms, postings) as well as per-document data.

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

Constructor Summary
protected PerDocConsumer()
          Sole constructor.
 
Method Summary
abstract  void abort()
          Called during indexing if the indexing session is aborted due to a unrecoverable exception.
abstract  DocValuesConsumer addValuesField(DocValues.Type type, FieldInfo field)
          Adds a new DocValuesField
protected  boolean canMerge(FieldInfo info)
          Returns true iff the given field can be merged ie.
abstract  void close()
           
protected  DocValues getDocValuesForMerge(AtomicReader reader, FieldInfo info)
          Returns a DocValues instance for merging from the given reader for the given FieldInfo.
protected  DocValues.Type getDocValuesType(FieldInfo info)
          Returns the DocValues DocValues.Type for the given FieldInfo.
 void merge(MergeState mergeState)
          Consumes and merges the given PerDocProducer producer into this consumers format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerDocConsumer

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

Method Detail

addValuesField

public abstract DocValuesConsumer addValuesField(DocValues.Type type,
                                                 FieldInfo field)
                                          throws IOException
Adds a new DocValuesField

Throws:
IOException

merge

public void merge(MergeState mergeState)
           throws IOException
Consumes and merges the given PerDocProducer producer into this consumers format.

Throws:
IOException

getDocValuesForMerge

protected DocValues getDocValuesForMerge(AtomicReader reader,
                                         FieldInfo info)
                                  throws IOException
Returns a DocValues instance for merging from the given reader for the given FieldInfo. This method is used for merging and uses AtomicReader.docValues(String) by default.

To enable DocValues merging for different DocValues than the default override this method accordingly.

Throws:
IOException

canMerge

protected boolean canMerge(FieldInfo info)
Returns true iff the given field can be merged ie. has DocValues. By default this method uses FieldInfo.hasDocValues().

To enable DocValues merging for different DocValues than the default override this method accordingly.


getDocValuesType

protected DocValues.Type getDocValuesType(FieldInfo info)
Returns the DocValues DocValues.Type for the given FieldInfo. By default this method uses FieldInfo.getDocValuesType().

To enable DocValues merging for different DocValues than the default override this method accordingly.


abort

public abstract void abort()
Called during indexing if the indexing session is aborted due to a unrecoverable exception. This method should cleanup all resources.


close

public abstract void close()
                    throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


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