org.apache.lucene.codecs.simpletext
Class SimpleTextDocValuesConsumer

java.lang.Object
  extended by org.apache.lucene.codecs.DocValuesConsumer
      extended by org.apache.lucene.codecs.simpletext.SimpleTextDocValuesConsumer

public class SimpleTextDocValuesConsumer
extends DocValuesConsumer

Writes plain-text DocValues.

FOR RECREATIONAL USE ONLY

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

Field Summary
protected  IOContext ctx
           
protected  Directory dir
           
protected  BytesRefHash hash
           
protected  int maxDocId
           
protected  BytesRef scratch
           
protected  String segment
           
protected  DocValues.Type type
           
 
Fields inherited from class org.apache.lucene.codecs.DocValuesConsumer
spare
 
Constructor Summary
SimpleTextDocValuesConsumer(String segment, Directory dir, IOContext ctx, DocValues.Type type, String segmentSuffix)
           
 
Method Summary
 void add(int docID, IndexableField value)
          Adds the given IndexableField instance to this DocValuesConsumer
 void finish(int docCount)
          Called when the consumer of this API is done adding values.
protected  BytesRef getHeader()
           
protected  DocValues.Type getType()
           
 int getValueSize()
          Returns the value size this consumer accepts or -1 iff this consumer is value size agnostic ie.
protected  void writeDoc(IndexOutput output, int docId, BytesRef spare)
           
 
Methods inherited from class org.apache.lucene.codecs.DocValuesConsumer
merge, merge, mergeDoc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scratch

protected BytesRef scratch

maxDocId

protected int maxDocId

segment

protected final String segment

dir

protected final Directory dir

ctx

protected final IOContext ctx

type

protected final DocValues.Type type

hash

protected final BytesRefHash hash
Constructor Detail

SimpleTextDocValuesConsumer

public SimpleTextDocValuesConsumer(String segment,
                                   Directory dir,
                                   IOContext ctx,
                                   DocValues.Type type,
                                   String segmentSuffix)
Method Detail

add

public void add(int docID,
                IndexableField value)
         throws IOException
Description copied from class: DocValuesConsumer
Adds the given IndexableField instance to this DocValuesConsumer

Specified by:
add in class DocValuesConsumer
Parameters:
docID - the document ID to add the value for. The docID must always increase or be 0 if it is the first call to this method.
value - the value to add
Throws:
IOException - if an IOException occurs

getHeader

protected BytesRef getHeader()

finish

public void finish(int docCount)
            throws IOException
Description copied from class: DocValuesConsumer
Called when the consumer of this API is done adding values.

Specified by:
finish in class DocValuesConsumer
Parameters:
docCount - the total number of documents in this DocValuesConsumer. Must be greater than or equal the last given docID to DocValuesConsumer.add(int, IndexableField).
Throws:
IOException

writeDoc

protected void writeDoc(IndexOutput output,
                        int docId,
                        BytesRef spare)
                 throws IOException
Throws:
IOException

getType

protected DocValues.Type getType()
Specified by:
getType in class DocValuesConsumer

getValueSize

public int getValueSize()
Description copied from class: DocValuesConsumer
Returns the value size this consumer accepts or -1 iff this consumer is value size agnostic ie. accepts variable length values.

NOTE: the return value is undefined until the consumer has successfully consumed at least one value.

Specified by:
getValueSize in class DocValuesConsumer
Returns:
the value size this consumer accepts or -1 iff this consumer is value size agnostic ie. accepts variable length values.


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