|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.creole.annic.apache.lucene.index.TermVectorsWriter
final class TermVectorsWriter
Writer works by opening a document and then opening the fields within the document and then
writing out the vectors for each field.
Rough usage:
for each document
{
writer.openDocument();
for each field on the document
{
writer.openField(field);
for all of the terms
{
writer.addTerm(...)
}
writer.closeField
}
writer.closeDocument()
}
| Nested Class Summary | |
|---|---|
private static class |
TermVectorsWriter.TVField
|
private static class |
TermVectorsWriter.TVTerm
|
| Field Summary | |
|---|---|
private long |
currentDocPointer
|
private TermVectorsWriter.TVField |
currentField
|
private FieldInfos |
fieldInfos
|
private Vector |
fields
|
static int |
FORMAT_SIZE
|
static int |
FORMAT_VERSION
|
private Vector |
terms
|
private OutputStream |
tvd
|
static String |
TVD_EXTENSION
|
private OutputStream |
tvf
|
static String |
TVF_EXTENSION
|
private OutputStream |
tvx
|
static String |
TVX_EXTENSION
|
| Constructor Summary | |
|---|---|
TermVectorsWriter(Directory directory,
String segment,
FieldInfos fieldInfos)
Create term vectors writer for the specified segment in specified directory. |
|
| Method Summary | |
|---|---|
void |
addTerm(String termText,
int freq)
Add term to the field's term vector. |
void |
addTermFreqVector(TermFreqVector vector)
Add specified vector to the document. |
private void |
addTermFreqVectorInternal(TermFreqVector vector)
|
private void |
addTermInternal(String termText,
int freq)
|
void |
addVectors(TermFreqVector[] vectors)
Add specified vectors to the document. |
(package private) void |
close()
Close all streams. |
void |
closeDocument()
|
void |
closeField()
Finished processing current field. |
boolean |
isDocumentOpen()
|
boolean |
isFieldOpen()
Return true if a field is currently open. |
void |
openDocument()
|
void |
openField(String field)
Start processing a field. |
private void |
writeDoc()
|
private void |
writeField()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FORMAT_VERSION
public static final int FORMAT_SIZE
public static final String TVX_EXTENSION
public static final String TVD_EXTENSION
public static final String TVF_EXTENSION
private OutputStream tvx
private OutputStream tvd
private OutputStream tvf
private Vector fields
private Vector terms
private FieldInfos fieldInfos
private TermVectorsWriter.TVField currentField
private long currentDocPointer
| Constructor Detail |
|---|
public TermVectorsWriter(Directory directory,
String segment,
FieldInfos fieldInfos)
throws IOException
maxFields indicates how many total
fields are found in this document. Not all of these fields may require
termvectors to be stored, so the number of calls to
openField is less or equal to this number.
IOException| Method Detail |
|---|
public final void openDocument()
throws IOException
IOException
public final void closeDocument()
throws IOException
IOExceptionpublic final boolean isDocumentOpen()
public final void openField(String field)
throws IOException
IOException
public final void closeField()
throws IOException
IOExceptionpublic final boolean isFieldOpen()
public final void addTerm(String termText,
int freq)
private final void addTermInternal(String termText,
int freq)
public final void addVectors(TermFreqVector[] vectors)
throws IOException
IOException
public final void addTermFreqVector(TermFreqVector vector)
throws IOException
addTerm
and addVectors calls mixed, however a given field must either be
populated with addTerm or with addVector. *
IOException
private final void addTermFreqVectorInternal(TermFreqVector vector)
throws IOException
IOException
final void close()
throws IOException
IOException
private void writeField()
throws IOException
IOException
private void writeDoc()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||