Class TermVectorsWriter

java.lang.Object
org.apache.lucene.codecs.TermVectorsWriter
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
CompressingTermVectorsWriter, Lucene40TermVectorsWriter

public abstract class TermVectorsWriter extends Object implements Closeable
Codec API for writing term vectors:

  1. For every document, startDocument(int) is called, informing the Codec how many fields will be written.
  2. startField(FieldInfo, int, boolean, boolean, boolean) is called for each field in the document, informing the codec how many terms will be written for that field, and whether or not positions, offsets, or payloads are enabled.
  3. Within each field, startTerm(BytesRef, int) is called for each term.
  4. If offsets and/or positions are enabled, then addPosition(int, int, int, BytesRef) will be called for each term occurrence.
  5. After all documents have been written, finish(FieldInfos, int) is called for verification/sanity-checks.
  6. Finally the writer is closed (close())
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Sole constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Aborts writing entirely, implementation should remove any partially-written files, etc.
    protected final void
    addAllDocVectors(Fields vectors, MergeState mergeState)
    Safe (but, slowish) default method to write every vector field in the document.
    abstract void
    addPosition(int position, int startOffset, int endOffset, BytesRef payload)
    Adds a term position and offsets
    void
    addProx(int numProx, DataInput positions, DataInput offsets)
    Called by IndexWriter when writing new segments.
    abstract void
     
    abstract void
    finish(FieldInfos fis, int numDocs)
    Called before close(), passing in the number of documents that were written.
    void
    Called after a doc and all its fields have been added.
    void
    Called after a field and all its terms have been added.
    void
    Called after a term and all its positions have been added.
    Return the BytesRef Comparator used to sort terms before feeding to this API.
    int
    merge(MergeState mergeState)
    Merges in the term vectors from the readers in mergeState.
    abstract void
    startDocument(int numVectorFields)
    Called before writing the term vectors of the document.
    abstract void
    startField(FieldInfo info, int numTerms, boolean positions, boolean offsets, boolean payloads)
    Called before writing the terms of the field.
    abstract void
    startTerm(BytesRef term, int freq)
    Adds a term and its term frequency freq.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TermVectorsWriter

      protected TermVectorsWriter()
      Sole constructor. (For invocation by subclass constructors, typically implicit.)
  • Method Details