org.apache.lucene.codecs.simpletext
Class SimpleTextTermVectorsWriter

java.lang.Object
  extended by org.apache.lucene.codecs.TermVectorsWriter
      extended by org.apache.lucene.codecs.simpletext.SimpleTextTermVectorsWriter
All Implemented Interfaces:
Closeable

public class SimpleTextTermVectorsWriter
extends TermVectorsWriter

Writes plain-text term vectors.

FOR RECREATIONAL USE ONLY

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

Constructor Summary
SimpleTextTermVectorsWriter(Directory directory, String segment, IOContext context)
           
 
Method Summary
 void abort()
          Aborts writing entirely, implementation should remove any partially-written files, etc.
 void addPosition(int position, int startOffset, int endOffset)
          Adds a term position and offsets
 void close()
           
 void finish(FieldInfos fis, int numDocs)
          Called before Closeable.close(), passing in the number of documents that were written.
 Comparator<BytesRef> getComparator()
          Return the BytesRef Comparator used to sort terms before feeding to this API.
 void startDocument(int numVectorFields)
          Called before writing the term vectors of the document.
 void startField(FieldInfo info, int numTerms, boolean positions, boolean offsets)
          Called before writing the terms of the field.
 void startTerm(BytesRef term, int freq)
          Adds a term and its term frequency freq.
 
Methods inherited from class org.apache.lucene.codecs.TermVectorsWriter
addAllDocVectors, addProx, merge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTextTermVectorsWriter

public SimpleTextTermVectorsWriter(Directory directory,
                                   String segment,
                                   IOContext context)
                            throws IOException
Throws:
IOException
Method Detail

startDocument

public void startDocument(int numVectorFields)
                   throws IOException
Description copied from class: TermVectorsWriter
Called before writing the term vectors of the document. TermVectorsWriter.startField(FieldInfo, int, boolean, boolean) will be called numVectorFields times. Note that if term vectors are enabled, this is called even if the document has no vector fields, in this case numVectorFields will be zero.

Specified by:
startDocument in class TermVectorsWriter
Throws:
IOException

startField

public void startField(FieldInfo info,
                       int numTerms,
                       boolean positions,
                       boolean offsets)
                throws IOException
Description copied from class: TermVectorsWriter
Called before writing the terms of the field. TermVectorsWriter.startTerm(BytesRef, int) will be called numTerms times.

Specified by:
startField in class TermVectorsWriter
Throws:
IOException

startTerm

public void startTerm(BytesRef term,
                      int freq)
               throws IOException
Description copied from class: TermVectorsWriter
Adds a term and its term frequency freq. If this field has positions and/or offsets enabled, then TermVectorsWriter.addPosition(int, int, int) will be called freq times respectively.

Specified by:
startTerm in class TermVectorsWriter
Throws:
IOException

addPosition

public void addPosition(int position,
                        int startOffset,
                        int endOffset)
                 throws IOException
Description copied from class: TermVectorsWriter
Adds a term position and offsets

Specified by:
addPosition in class TermVectorsWriter
Throws:
IOException

abort

public void abort()
Description copied from class: TermVectorsWriter
Aborts writing entirely, implementation should remove any partially-written files, etc.

Specified by:
abort in class TermVectorsWriter

finish

public void finish(FieldInfos fis,
                   int numDocs)
            throws IOException
Description copied from class: TermVectorsWriter
Called before Closeable.close(), passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls to TermVectorsWriter.startDocument(int), but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282.

Specified by:
finish in class TermVectorsWriter
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

getComparator

public Comparator<BytesRef> getComparator()
                                   throws IOException
Description copied from class: TermVectorsWriter
Return the BytesRef Comparator used to sort terms before feeding to this API.

Specified by:
getComparator in class TermVectorsWriter
Throws:
IOException


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