CLucene - a full-featured, c++ search engine
API Documentation


lucene::index::TermVectorsWriter Class Reference

Writer works by opening a document and then opening the fields within the document and then writing out the vectors for each field. More...

#include <TermVector.h>

Inheritance diagram for lucene::index::TermVectorsWriter:
lucene::debug::LuceneBase

List of all members.

Classes

class  TVField
class  TVTerm

Public Member Functions

 LUCENE_STATIC_CONSTANT (int32_t, FORMAT_VERSION=2)
 LUCENE_STATIC_CONSTANT (int32_t, FORMAT_SIZE=4)
 LUCENE_STATIC_CONSTANT (uint8_t, STORE_POSITIONS_WITH_TERMVECTOR=0x1)
 LUCENE_STATIC_CONSTANT (uint8_t, STORE_OFFSET_WITH_TERMVECTOR=0x2)
 TermVectorsWriter (lucene::store::Directory *directory, const char *segment, FieldInfos *fieldInfos)
 ~TermVectorsWriter ()
void openDocument ()
void closeDocument ()
void close ()
 Close all streams.
bool isDocumentOpen () const
void openField (const TCHAR *field)
 Start processing a field.
void closeField ()
 Finished processing current field.
bool isFieldOpen () const
 Return true if a field is currently open.
void addAllDocVectors (Array< TermFreqVector * > &vectors)
 Add a complete document specified by all its term vectors.
void addTerm (const TCHAR *termText, int32_t freq, Array< int32_t > *positions=NULL, Array< TermVectorOffsetInfo > *offsets=NULL)
 Add term to the field's term vector.

Static Public Attributes

static const char * LUCENE_TVX_EXTENSION
static const char * LUCENE_TVD_EXTENSION
static const char * LUCENE_TVF_EXTENSION

Detailed Description

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() }


Constructor & Destructor Documentation

lucene::index::TermVectorsWriter::TermVectorsWriter ( lucene::store::Directory directory,
const char *  segment,
FieldInfos fieldInfos 
)
lucene::index::TermVectorsWriter::~TermVectorsWriter (  ) 

Member Function Documentation

void lucene::index::TermVectorsWriter::addAllDocVectors ( Array< TermFreqVector * > &  vectors  ) 

Add a complete document specified by all its term vectors.

If document has no term vectors, add value for tvx.

Parameters:
vectors 
Exceptions:
IOException 
void lucene::index::TermVectorsWriter::addTerm ( const TCHAR *  termText,
int32_t  freq,
Array< int32_t > *  positions = NULL,
Array< TermVectorOffsetInfo > *  offsets = NULL 
)

Add term to the field's term vector.

Field must already be open. Terms should be added in increasing order of terms, one call per unique termNum. ProxPointer is a pointer into the TermPosition file (prx). Freq is the number of times this term appears in this field, in this document.

Exceptions:
IllegalStateException if document or field is not open
void lucene::index::TermVectorsWriter::close (  ) 

Close all streams.

void lucene::index::TermVectorsWriter::closeDocument (  ) 
void lucene::index::TermVectorsWriter::closeField (  ) 

Finished processing current field.

This should be followed by a call to openField before future calls to addTerm.

bool lucene::index::TermVectorsWriter::isDocumentOpen (  )  const
bool lucene::index::TermVectorsWriter::isFieldOpen (  )  const

Return true if a field is currently open.

lucene::index::TermVectorsWriter::LUCENE_STATIC_CONSTANT ( uint8_t  ,
STORE_OFFSET_WITH_TERMVECTOR  = 0x2 
)
lucene::index::TermVectorsWriter::LUCENE_STATIC_CONSTANT ( uint8_t  ,
STORE_POSITIONS_WITH_TERMVECTOR  = 0x1 
)
lucene::index::TermVectorsWriter::LUCENE_STATIC_CONSTANT ( int32_t  ,
FORMAT_SIZE  = 4 
)
lucene::index::TermVectorsWriter::LUCENE_STATIC_CONSTANT ( int32_t  ,
FORMAT_VERSION  = 2 
)
void lucene::index::TermVectorsWriter::openDocument (  ) 
void lucene::index::TermVectorsWriter::openField ( const TCHAR *  field  ) 

Start processing a field.

This can be followed by a number of calls to addTerm, and a final call to closeField to indicate the end of processing of this field. If a field was previously open, it is closed automatically.


Member Data Documentation


The documentation for this class was generated from the following file:

clucene.sourceforge.net