public final class CompressingTermVectorsWriter extends TermVectorsWriter
NULL_ACCOUNTABLE
Modifier and Type | Method and Description |
---|---|
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.
|
void |
close() |
void |
finish(FieldInfos fis,
int numDocs)
Called before
TermVectorsWriter.close() , passing in the number
of documents that were written. |
void |
finishDocument()
Called after a doc and all its fields have been added.
|
void |
finishField()
Called after a field and all its terms have been added.
|
Collection<Accountable> |
getChildResources()
Returns nested resources of this class.
|
int |
merge(MergeState mergeState)
Merges in the term vectors from the readers in
mergeState . |
long |
ramBytesUsed()
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 |
startTerm(BytesRef term,
int freq)
Adds a term and its term frequency
freq . |
addAllDocVectors, finishTerm
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class TermVectorsWriter
IOException
public void startDocument(int numVectorFields) throws 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
IOException
public void finishDocument() throws IOException
TermVectorsWriter
finishDocument
in class TermVectorsWriter
IOException
public void startField(FieldInfo info, int numTerms, boolean positions, boolean offsets, boolean payloads) throws IOException
TermVectorsWriter
TermVectorsWriter.startTerm(BytesRef, int)
will be called numTerms
times.startField
in class TermVectorsWriter
IOException
public void finishField() throws IOException
TermVectorsWriter
finishField
in class TermVectorsWriter
IOException
public void startTerm(BytesRef term, int freq) throws 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
IOException
public void addPosition(int position, int startOffset, int endOffset, BytesRef payload) throws IOException
TermVectorsWriter
addPosition
in class TermVectorsWriter
IOException
public void finish(FieldInfos fis, int numDocs) throws 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
IOException
public void addProx(int numProx, DataInput positions, DataInput offsets) throws IOException
TermVectorsWriter
This is an expert API that allows the codec to consume positions and offsets directly from the indexer.
The default implementation calls TermVectorsWriter.addPosition(int, int, int, BytesRef)
,
but subclasses can override this if they want to efficiently write
all the positions, then all the offsets, for example.
NOTE: This API is extremely expert and subject to change or removal!!!
addProx
in class TermVectorsWriter
IOException
public int merge(MergeState mergeState) throws IOException
TermVectorsWriter
mergeState
. The default implementation skips
over deleted documents, and uses TermVectorsWriter.startDocument(int)
,
TermVectorsWriter.startField(FieldInfo, int, boolean, boolean, boolean)
,
TermVectorsWriter.startTerm(BytesRef, int)
, TermVectorsWriter.addPosition(int, int, int, BytesRef)
,
and TermVectorsWriter.finish(FieldInfos, int)
,
returning the number of documents that were written.
Implementations can override this method for more sophisticated
merging (bulk-byte copying, etc).merge
in class TermVectorsWriter
IOException
public long ramBytesUsed()
Accountable
public Collection<Accountable> getChildResources()
Accountable
Accountables
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.