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


lucene::index::SegmentReader Class Reference

An IndexReader responsible for reading 1 segment of an index. More...

#include <SegmentHeader.h>

Inheritance diagram for lucene::index::SegmentReader:
lucene::index::IndexReader lucene::debug::LuceneBase

List of all members.

Classes

class  Norm
 The class Norm represents the normalizations for a field.

Public Member Functions

 SegmentReader (SegmentInfo *si)
 Func - Constructor.
 SegmentReader (SegmentInfos *sis, SegmentInfo *si)
virtual ~SegmentReader ()
 Destructor.
void doClose ()
 Closes all streams to the files of a single segment.
bool hasDeletions () const
 Returns true if any documents have been deleted.
bool hasNorms (const TCHAR *field) const
void files (lucene::util::AStringArrayWithDeletor &retarray)
 Returns all file names managed by this SegmentReader.
TermEnumterms () const
 Returns an enumeration of all the Terms and TermInfos in the set.
TermEnumterms (const Term *t) const
 Returns an enumeration of terms starting at or after the named term t.
bool document (int32_t n, lucene::document::Document *doc)
 Gets the document identified by n.
bool isDeleted (const int32_t n)
 Checks if the n-th document has been marked deleted.
TermDocstermDocs () const
 Returns an unpositioned TermDocs enumerator.
TermPositionstermPositions () const
 Returns an unpositioned TermPositions enumerator.
int32_t docFreq (const Term *t) const
 Returns the number of documents which contain the term t.
int32_t numDocs ()
 Returns the actual number of documents in the segment.
int32_t maxDoc () const
 Returns the number of all the documents in the segment including the ones that have been marked deleted.
uint8_t * norms (const TCHAR *field)
 Returns the bytes array that holds the norms of a named field.
void norms (const TCHAR *field, uint8_t *bytes)
 Reads the Norms for field from disk.
char * SegmentName (const char *ext, const int32_t x=-1)
 concatenating segment with ext and x
void SegmentName (char *buffer, int32_t bufferLen, const char *ext, const int32_t x=-1)
 Creates a filename in buffer by concatenating segment with ext and x.
void getFieldNames (FieldOption fldOption, lucene::util::StringArrayWithDeletor &retarray)
TermFreqVectorgetTermFreqVector (int32_t docNumber, const TCHAR *field=NULL)
 Return a term frequency vector for the specified document and field.
bool getTermFreqVectors (int32_t docNumber, Array< TermFreqVector * > &result)
 Return an array of term frequency vectors for the specified document.

Static Public Member Functions

static bool hasDeletions (const SegmentInfo *si)
 Checks if a segment managed by SegmentInfo si has deletions.
static bool usesCompoundFile (SegmentInfo *si)

Protected Member Functions

void doDelete (const int32_t docNum)
 Marks document docNum as deleted.
void doUndeleteAll ()
 Implements actual undeleteAll() in subclass.
void doCommit ()
 Internal use.
void doSetNorm (int32_t doc, const TCHAR *field, uint8_t value)
 Implements setNorm in subclass.
uint8_t * getNorms (const TCHAR *field)

Friends

class SegmentReader::Norm
class IndexReader
class IndexWriter
class SegmentTermDocs
class SegmentTermPositions
class MultiReader

Detailed Description

An IndexReader responsible for reading 1 segment of an index.


Constructor & Destructor Documentation

lucene::index::SegmentReader::SegmentReader ( SegmentInfo si  ) 

Func - Constructor.

Opens all files of a segment .fnm -> Field Info File Field names are stored in the field info file, with suffix .fnm. .frq -> Frequency File The .frq file contains the lists of documents which contain each term, along with the frequency of the term in that document. .prx -> Prox File The prox file contains the lists of positions that each term occurs at within documents. .tis -> Term Info File This file is sorted by Term. Terms are ordered first lexicographically by the term's field name, and within that lexicographically by the term's text. .del -> Deletion File The .del file is optional, and only exists when a segment contains deletions .f[0-9]* -> Norm File Contains s, for each document, a byte that encodes a value that is multiplied into the score for hits on that field:

lucene::index::SegmentReader::SegmentReader ( SegmentInfos sis,
SegmentInfo si 
)
virtual lucene::index::SegmentReader::~SegmentReader (  )  [virtual]

Destructor.


Member Function Documentation

int32_t lucene::index::SegmentReader::docFreq ( const Term t  )  const [virtual]

Returns the number of documents which contain the term t.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::doClose (  )  [virtual]

Closes all streams to the files of a single segment.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::doCommit (  )  [protected, virtual]

Internal use.

Implements commit

Implements lucene::index::IndexReader.

bool lucene::index::SegmentReader::document ( int32_t  n,
lucene::document::Document doc 
) [virtual]

Gets the document identified by n.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::doDelete ( const int32_t  docNum  )  [protected, virtual]

Marks document docNum as deleted.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::doSetNorm ( int32_t  doc,
const TCHAR *  field,
uint8_t  value 
) [protected, virtual]

Implements setNorm in subclass.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::doUndeleteAll (  )  [protected, virtual]

Implements actual undeleteAll() in subclass.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::files ( lucene::util::AStringArrayWithDeletor retarray  ) 

Returns all file names managed by this SegmentReader.

void lucene::index::SegmentReader::getFieldNames ( FieldOption  fldOption,
lucene::util::StringArrayWithDeletor retarray 
) [virtual]
uint8_t* lucene::index::SegmentReader::getNorms ( const TCHAR *  field  )  [protected]
TermFreqVector* lucene::index::SegmentReader::getTermFreqVector ( int32_t  docNumber,
const TCHAR *  field = NULL 
) [virtual]

Return a term frequency vector for the specified document and field.

The vector returned contains term numbers and frequencies for all terms in the specified field of this document, if the field had storeTermVector flag set. If the flag was not set, the method returns null.

Exceptions:
IOException 

Implements lucene::index::IndexReader.

bool lucene::index::SegmentReader::getTermFreqVectors ( int32_t  docNumber,
Array< TermFreqVector * > &  result 
) [virtual]

Return an array of term frequency vectors for the specified document.

The array contains a vector for each vectorized field in the document. Each vector vector contains term numbers and frequencies for all terms in a given vectorized field. If no such fields existed, the method returns null.

Exceptions:
IOException 

Implements lucene::index::IndexReader.

bool lucene::index::SegmentReader::hasDeletions (  )  const [virtual]

Returns true if any documents have been deleted.

Implements lucene::index::IndexReader.

static bool lucene::index::SegmentReader::hasDeletions ( const SegmentInfo si  )  [static]

Checks if a segment managed by SegmentInfo si has deletions.

bool lucene::index::SegmentReader::hasNorms ( const TCHAR *  field  )  const
bool lucene::index::SegmentReader::isDeleted ( const int32_t  n  )  [virtual]

Checks if the n-th document has been marked deleted.

Implements lucene::index::IndexReader.

int32_t lucene::index::SegmentReader::maxDoc (  )  const [virtual]

Returns the number of all the documents in the segment including the ones that have been marked deleted.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::norms ( const TCHAR *  field,
uint8_t *  bytes 
) [virtual]

Reads the Norms for field from disk.

Implements lucene::index::IndexReader.

uint8_t* lucene::index::SegmentReader::norms ( const TCHAR *  field  )  [virtual]

Returns the bytes array that holds the norms of a named field.

Returns fake norms if norms aren't available

Implements lucene::index::IndexReader.

int32_t lucene::index::SegmentReader::numDocs (  )  [virtual]

Returns the actual number of documents in the segment.

Implements lucene::index::IndexReader.

void lucene::index::SegmentReader::SegmentName ( char *  buffer,
int32_t  bufferLen,
const char *  ext,
const int32_t  x = -1 
)

Creates a filename in buffer by concatenating segment with ext and x.

char* lucene::index::SegmentReader::SegmentName ( const char *  ext,
const int32_t  x = -1 
)

concatenating segment with ext and x

TermDocs* lucene::index::SegmentReader::termDocs (  )  const [virtual]

Returns an unpositioned TermDocs enumerator.

Implements lucene::index::IndexReader.

TermPositions* lucene::index::SegmentReader::termPositions (  )  const [virtual]

Returns an unpositioned TermPositions enumerator.

Implements lucene::index::IndexReader.

TermEnum* lucene::index::SegmentReader::terms ( const Term t  )  const [virtual]

Returns an enumeration of terms starting at or after the named term t.

Implements lucene::index::IndexReader.

TermEnum* lucene::index::SegmentReader::terms (  )  const [virtual]

Returns an enumeration of all the Terms and TermInfos in the set.

Implements lucene::index::IndexReader.

static bool lucene::index::SegmentReader::usesCompoundFile ( SegmentInfo si  )  [static]

Friends And Related Function Documentation

friend class IndexReader [friend]
friend class IndexWriter [friend]
friend class MultiReader [friend]
friend class SegmentReader::Norm [friend]
friend class SegmentTermDocs [friend]
friend class SegmentTermPositions [friend]

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

clucene.sourceforge.net