Class SimpleTextTermVectorsWriter
java.lang.Object
org.apache.lucene.codecs.TermVectorsWriter
org.apache.lucene.codecs.simpletext.SimpleTextTermVectorsWriter
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Accountable
Writes plain-text term vectors.
FOR RECREATIONAL USE ONLY
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
private int
(package private) static final BytesRef
private boolean
private IndexOutput
(package private) static final BytesRef
private boolean
(package private) static final BytesRef
private boolean
private final BytesRefBuilder
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final BytesRef
(package private) static final String
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleTextTermVectorsWriter
(Directory directory, String segment, IOContext context) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPosition
(int position, int startOffset, int endOffset, BytesRef payload) Adds a term position and offsetsvoid
close()
void
finish
(int numDocs) Called beforeTermVectorsWriter.close()
, passing in the number of documents that were written.private void
newLine()
long
Return the memory usage of this object in bytes.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
Adds a term and its term frequencyfreq
.private void
private void
Methods inherited from class org.apache.lucene.codecs.TermVectorsWriter
addAllDocVectors, addProx, finishDocument, finishField, finishTerm, merge
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Field Details
-
END
-
DOC
-
NUMFIELDS
-
FIELD
-
FIELDNAME
-
FIELDPOSITIONS
-
FIELDOFFSETS
-
FIELDPAYLOADS
-
FIELDTERMCOUNT
-
TERMTEXT
-
TERMFREQ
-
POSITION
-
PAYLOAD
-
STARTOFFSET
-
ENDOFFSET
-
VECTORS_EXTENSION
- See Also:
-
out
-
numDocsWritten
private int numDocsWritten -
scratch
-
offsets
private boolean offsets -
positions
private boolean positions -
payloads
private boolean payloads
-
-
Constructor Details
-
SimpleTextTermVectorsWriter
public SimpleTextTermVectorsWriter(Directory directory, String segment, IOContext context) throws IOException - Throws:
IOException
-
-
Method Details
-
startDocument
Description copied from class:TermVectorsWriter
Called before writing the term vectors of the document.TermVectorsWriter.startField(FieldInfo, int, boolean, boolean, boolean)
will be callednumVectorFields
times. Note that if term vectors are enabled, this is called even if the document has no vector fields, in this casenumVectorFields
will be zero.- Specified by:
startDocument
in classTermVectorsWriter
- Throws:
IOException
-
startField
public void startField(FieldInfo info, int numTerms, boolean positions, boolean offsets, boolean payloads) throws IOException Description copied from class:TermVectorsWriter
Called before writing the terms of the field.TermVectorsWriter.startTerm(BytesRef, int)
will be callednumTerms
times.- Specified by:
startField
in classTermVectorsWriter
- Throws:
IOException
-
startTerm
Description copied from class:TermVectorsWriter
Adds a term and its term frequencyfreq
. If this field has positions and/or offsets enabled, thenTermVectorsWriter.addPosition(int, int, int, BytesRef)
will be calledfreq
times respectively.- Specified by:
startTerm
in classTermVectorsWriter
- Throws:
IOException
-
addPosition
public void addPosition(int position, int startOffset, int endOffset, BytesRef payload) throws IOException Description copied from class:TermVectorsWriter
Adds a term position and offsets- Specified by:
addPosition
in classTermVectorsWriter
- Throws:
IOException
-
finish
Description copied from class:TermVectorsWriter
Called beforeTermVectorsWriter.close()
, passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls toTermVectorsWriter.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 classTermVectorsWriter
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classTermVectorsWriter
- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
newLine
- Throws:
IOException
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.
-