public class SimpleTextTermVectorsWriter extends TermVectorsWriter
FOR RECREATIONAL USE ONLY
Modifier and Type | Field and Description |
---|---|
private Directory |
directory |
(package private) static BytesRef |
DOC |
(package private) static BytesRef |
END |
(package private) static BytesRef |
ENDOFFSET |
(package private) static BytesRef |
FIELD |
(package private) static BytesRef |
FIELDNAME |
(package private) static BytesRef |
FIELDOFFSETS |
(package private) static BytesRef |
FIELDPAYLOADS |
(package private) static BytesRef |
FIELDPOSITIONS |
(package private) static BytesRef |
FIELDTERMCOUNT |
private int |
numDocsWritten |
(package private) static BytesRef |
NUMFIELDS |
private boolean |
offsets |
private IndexOutput |
out |
(package private) static BytesRef |
PAYLOAD |
private boolean |
payloads |
(package private) static BytesRef |
POSITION |
private boolean |
positions |
private BytesRefBuilder |
scratch |
private java.lang.String |
segment |
(package private) static BytesRef |
STARTOFFSET |
(package private) static BytesRef |
TERMFREQ |
(package private) static BytesRef |
TERMTEXT |
(package private) static java.lang.String |
VECTORS_EXTENSION |
Constructor and Description |
---|
SimpleTextTermVectorsWriter(Directory directory,
java.lang.String segment,
IOContext context) |
Modifier and Type | Method and Description |
---|---|
void |
addPosition(int position,
int startOffset,
int endOffset,
BytesRef payload)
Adds a term position and offsets
|
void |
close() |
void |
finish(FieldInfos fis,
int numDocs)
Called before
TermVectorsWriter.close() , passing in the number
of documents that were written. |
private void |
newLine() |
void |
startDocument(int numVectorFields)
Called before writing the term vectors of the document.
|
void |
startField(FieldInfo info,
int numTerms,
boolean positions,
boolean offsets,
boolean payloads)
Called before writing the terms of the field.
|
void |
startTerm(BytesRef term,
int freq)
Adds a term and its term frequency
freq . |
private void |
write(BytesRef bytes) |
private void |
write(java.lang.String s) |
addAllDocVectors, addProx, finishDocument, finishField, finishTerm, merge
static final BytesRef END
static final BytesRef DOC
static final BytesRef NUMFIELDS
static final BytesRef FIELD
static final BytesRef FIELDNAME
static final BytesRef FIELDPOSITIONS
static final BytesRef FIELDOFFSETS
static final BytesRef FIELDPAYLOADS
static final BytesRef FIELDTERMCOUNT
static final BytesRef TERMTEXT
static final BytesRef TERMFREQ
static final BytesRef POSITION
static final BytesRef PAYLOAD
static final BytesRef STARTOFFSET
static final BytesRef ENDOFFSET
static final java.lang.String VECTORS_EXTENSION
private final Directory directory
private final java.lang.String segment
private IndexOutput out
private int numDocsWritten
private final BytesRefBuilder scratch
private boolean offsets
private boolean positions
private boolean payloads
public void startDocument(int numVectorFields) throws java.io.IOException
TermVectorsWriter
TermVectorsWriter.startField(FieldInfo, int, boolean, 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.startDocument
in class TermVectorsWriter
java.io.IOException
public void startField(FieldInfo info, int numTerms, boolean positions, boolean offsets, boolean payloads) throws java.io.IOException
TermVectorsWriter
TermVectorsWriter.startTerm(BytesRef, int)
will be called numTerms
times.startField
in class TermVectorsWriter
java.io.IOException
public void startTerm(BytesRef term, int freq) throws java.io.IOException
TermVectorsWriter
freq
.
If this field has positions and/or offsets enabled, then
TermVectorsWriter.addPosition(int, int, int, BytesRef)
will be called
freq
times respectively.startTerm
in class TermVectorsWriter
java.io.IOException
public void addPosition(int position, int startOffset, int endOffset, BytesRef payload) throws java.io.IOException
TermVectorsWriter
addPosition
in class TermVectorsWriter
java.io.IOException
public void finish(FieldInfos fis, int numDocs) throws java.io.IOException
TermVectorsWriter
TermVectorsWriter.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.finish
in class TermVectorsWriter
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class TermVectorsWriter
java.io.IOException
private void write(java.lang.String s) throws java.io.IOException
java.io.IOException
private void write(BytesRef bytes) throws java.io.IOException
java.io.IOException
private void newLine() throws java.io.IOException
java.io.IOException